I note that one of the slashes is in the wrong direction in your manifest?
Unable to locate file in Vite manifest: resources/css/app.css
Dear enlightened artisans,
I pulled my Laravel project that is running "Laravel version 9.21.3", "laravel-vite-plugin": "^0.5.0", and "vite": "^3.0.2" from my repository to local. I did all essential commands such as composer install, npm install and npm run build. Instead of running npm run dev, I built the assets running npm run build. I tried to serve the app running php artisan serve, the browser showed the following error:
Unable to locate file in Vite manifest: resources/css/app.css
The manifest.json file is resided in The file C:\xampp\htdocs\example-app\public\build\manifest.json with following configuration:
{
"resources/js/app.js": {
"file": "assets/app.d225c007.js",
"src": "resources/js/app.js",
"isEntry": true
},
"resources/css\app.css": {
"file": "assets/app.ac31adfe.css",
"src": "resources/css\app.css"
}
}
Instead of using @vite directive @vite(['resources/css/app.css', 'resources/js/app.js']), I commented out that @vite directive and linked the build assets as following in my app.blade.php:
<link rel="stylesheet" href="{{ asset('build/assets/app.ac31adfe.css') }}">
<script src="{{ asset('build/assets/app.d225c007.js') }}"></script>
Now the error goes away. The docs says that running the build command will version and bundle your application's assets and get them ready for you to deploy to production. Same thing happened when I deployed the app on the server. Do I always run npm run dev on both local and production? Doesn't the Vite automatically place the bundled assets? As being a noob developer, am I missing something? Your expert knowledge will be appreciated. Thank you! ππ
Please or to participate in this conversation.