Even tho I run npm run build
without an issue, when I try to open the app (192.168.1.17:8080), it throws “Unable to locate file in Vite manifest: resources/css/app.css”. This error only happens when trying to serve on the local network.
Laravel: 10.46.0
Vite: 5.0.0
"scripts": {
"dev": "vite",
"build": "vite build"
},
commands ran:
npm run build
–> success, no error
php artisan serve --host=192.168.1.17 --host=8080
–> success, no error
but when I open the site, it throws Unable to locate file in Vite manifest: resourcescssapp.css.
.
( I use @vite(['resourcescssapp.css', 'resourcesjsapp.js'])
in my blade file, as instructed in the documentation )
If I run npm run dev
, the site loads, but no css-js is available (just the barebone html is loaded in).
The main reason I want to serve to the local network, so I can test how difficult it actually is to reach/see buttons/forms on mobile/tablet, etc. (yes, I know devtools exists, but we noticed that sometimes its very inaccurate, so I want to test on my actual phone to get the actual feel of it.)
Tried:
npm run dev
,
npm run dev -- --host
, (as instructed in other posts)
npm run build
,
php artisan serve --host=192.168.1.17
, (with and without specifying a port)
php artisan optimize:clear
,
composer clearcache
,
composer dump-autoload
,
restarting, checking if ports are open to local network (they are), adding
server: {
host: true
}
to vite.config.js,
but none of them succeeded.
I’ve also looked through several other stack posts, reddit posts, and other forum posts about this issue, but none served with a working solution.
It should work, because I’ve done this before a few months ago, and then all I had to do was serve on my local ip, npm run build
, and it worked. Now it doesn’t work.
rust_floppy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.