I'm trying to deploy a Laravel 9 project on an Ubuntu 20 server.
On localhost everything works, but on the server, when I try to open the website, I get this error:
Vite manifest not found at: /var/www/example.com/public/resources/assets/js/myScripts.js/manifest.json
The line in the Blade template producing the error seems to be this one:
@vite('resources/assets/sass/app.scss', 'resources/assets/js/myScripts.js')
I made sure to run npm run build
and checked that the manifest.json
file is generated correctly, which it is.
The content of public/build/manifest.json
is something like this:
{
"resources/assets/js/myScripts.js": {
"file": "assets/myScripts.47ff47b1.js",
"src": "resources/assets/js/myScripts.js",
"isEntry": true,
"imports": [
"_jquery.0178a139.js"
]
},
...
...
"resources/assets/sass/app.scss": {
"file": "assets/app.439d8351.css",
"src": "resources/assets/sass/app.scss",
"isEntry": true
}
Any suggestions?
You need to pass the resources as an array in your statement, when passing more than one file:
@vite(['resources/assets/sass/app.scss', 'resources/assets/js/myScripts.js'])
The second parameter in @vite
looks like its for setting a custom path for the manifest.json
file, which in this case is looking at your myScripts.js