Skip to content

Commit

Permalink
wip - update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gwleuverink committed Jun 20, 2024
1 parent 646bbc7 commit a8f3afc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/local-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ In order to use this script directly in your blade views, you simply need to imp

You can use this mechanism to immediatly execute some code to, for example, bootstrap & import other libraries.

Bundle's primary goal is to get imports inside your Blade template. While this strategy can be very powerful, it is not the place to put a lot of business code since can be a lot harder to debug.

Consider the following example file `resources/js/hello-world.js`:

```javascript
Expand Down Expand Up @@ -92,6 +90,8 @@ When importing this module you can omit the `as` prop. Axios will be available o

Note that your consuming script still needs to be of `type="module"` otherwise `window.axios` will be undefined.

It is also good to note that Bundle's primary goal is to get imports inside your Blade template. While the init strategy can be very powerful, it is not the place to put a lot of business code since can be a lot harder to debug.

{: .warning }

> Code splitting is [not supported](https://laravel-bundle.dev/caveats.html#code-splitting). Be careful when importing modules in your local scripts like this. When two script rely on the same dependency, it will be included in both bundles. This approach is meant to be used as a method to allow setup of more complex libraries. It is recommended to place business level code inside your templates instead.

0 comments on commit a8f3afc

Please sign in to comment.