vite not recognizing app.js?
I'm using Laravel 10 in a Filament project with vite. I have pretty much the stock vite.config.js file:
I have this in my blade layout file in the head:
In my
I've run npm run build, but I don't even get the simple "test" message from the console.log statement in app.js. It almost seems like vite isn't loading the app.js file at all. I should at the very least see the "test" message from app.js, right?
I upgraded the laravel-vite plugin to 1.0.1 and upgraded vite to 5.0.0, but that hasn't resolved it either. I've cleared the cache and hard refreshed. I've verified that jsConfetti is in my node_modules folder.
Also, I see no app.js in my sources in dev tools, which I'm thinking should be in the js folder?
I have this in my blade layout file in the head:
@vite(['resources/css/app.css', 'resources/js/app.js'])In my
resources/js/app.js file I have this:I've run npm run build, but I don't even get the simple "test" message from the console.log statement in app.js. It almost seems like vite isn't loading the app.js file at all. I should at the very least see the "test" message from app.js, right?
I upgraded the laravel-vite plugin to 1.0.1 and upgraded vite to 5.0.0, but that hasn't resolved it either. I've cleared the cache and hard refreshed. I've verified that jsConfetti is in my node_modules folder.
Also, I see no app.js in my sources in dev tools, which I'm thinking should be in the js folder?
Solution
I have this in my blade layout file in the head:
@vite(['resources/css/app.css', 'resources/js/app.js'])
Which layout? Did you override Filaments layout? You should use Filaments methods to add Javascript:
https://filamentphp.com/docs/3.x/support/assets#registering-javascript-files