I have created Laravel application based on this guide:
- PHP 8.1.2
- Laravel 9.33.0
- React
When working with VITE as dev (npm run dev), everything is OK
But when building JS and CSS with VITE (npm run build), then I get following error:
Unable to locate file in Vite manifest: resources/js/app.jsx
php artisan serve is active, php artisan optimize:clear done, npm updated to latest, etc. but still the same problem.
Will be great to get some more tips how to solve this problem.
Thank you, Jan
2
Answers
I have the same problem.
When I added ‘resources/js/app.jsx’ in vite.config.js file and run
npm run build
againthe problem was fixed.
Hope this help.
I had a similar problem. I write down here my solution for somebody with this headache:
My problem was that Vite was not transforming the components under the Pages folder, so it gave an error that the file cannot be found in the manifest.
To solve it you have to open the app.jsx file and import the following package:
And then you have to modify the createInertiaApp in app.jsx function so that it looks as follows:
Finally:
npm run build
And everything is working for me.
Hope this help.