inertiajs/inertia-laravel

External JS files not working unless you manually reload the page

Closed this issue · 1 comments

I need a quick help with understanding how to best include all the external .js files and .css files in a laravel + vuejs + inertia installation. What I notice is that the depencies are not loaded unless the page is reloaded. Why is that? or am I doing something wrong?

What I've done is for example is to have the following excerpt placed in the tag of the app.blade.php file

<script src="{{asset('ui-kit/js/settings.js')}}"></script> <script src="{{asset('ui-kit/js/app.js')}}"></script>

While this works, I notice the page needs to be reloaded in order for all the necessary dependent files to be loaded in the current page i recently navigated to using inertia

This is related to your own code and the Laravel Framework. It's nothing to do with Inertia frontend or backend.

I'd suggest re-reading the documentation on asset bundling. You also seem to be using the functions for Laravel Mix/WebPack when Laravel 9+ has been using Vite for its default bundling.

In future, please use the appropriate help channels on Discord (e.g. the Laravel help channel)