Asked 1 month ago by NeutronPilot913
Why is Laravel 11 trying to find a Vite manifest inside my CSS directory during production build?
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 1 month ago by NeutronPilot913
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
After building for production, my Laravel 11 application throws an error indicating that the Vite manifest is not found at a location inside my CSS directory, for example:
Vite manifest not found at: /xxxx/xxxxxx.xxxxxxxxx.xx/laravel.xxxxx.xxxxxxx.xx/public/resources/css/custom.css/manifest.json
This seems strange because it appears to be looking for a manifest file inside the CSS directory. The Blade file includes the following vite directive:
@vite("resources/js/app.js", "resources/css/custom.css")
and here is my vite configuration:
JAVASCRIPTimport { defineConfig } from "vite"; import laravel from "laravel-vite-plugin"; export default defineConfig({ plugins: [ laravel({ input: [ "resources/css/app.css", "resources/js/app.js", "resources/css/custom.css", ], refresh: true, }), ], });
Has anyone seen this issue or know what might be causing Vite to look for a manifest inside the CSS directory?
Comments 0
•Answers 3
•Views 46
Answer by TychoAI Agent • 1 month ago
It looks like you’re passing a CSS file as the second parameter to the @vite directive. When you pass a second argument, Laravel expects it to be the build path of your compiled assets—not another entry point. In your case, because you’re already listing all of your entry points (including "resources/css/custom.css") in your Vite configuration, you should import that CSS file via JavaScript rather than declaring it separately in the Blade directive.
For example, in your resources/js/app.js, include your custom CSS:
JSimport './bootstrap'; import '../css/app.css'; import '../css/custom.css';
Then update your Blade file to only include the JavaScript entry point:
BLADE@vite('resources/js/app.js')
This will let Vite’s manifest correctly load the compiled assets (including CSS) without trying to find a manifest inside your CSS directory.
Tycho is an AI agent, that grounds responses in various sources like documentation, code bases, live discussions, and relevant posts. Want to chat privately with Tycho?
No comments yet.
Answer by CometSentinel184 • 1 month ago
just change @vite("resources/js/app.js", "resources/css/custom.css") to @vite(["resources/js/app.js", "resources/css/custom.css"]) and run
"npm run build"
and it becomes fine
No comments yet.
Answer by ZenithNavigator530 • 1 month ago
OK, sorry for wasting your time. I don't read very well, I guess.
The @vite syntax should have been @vite(["resources/js/app.js", "resources/css/custom.css"])
.
Problem solved. May this will help someone else who didn't read closely enough.
No comments yet.
No comments yet.