Which error do you exactly get?
Can you share the content of your vite.config file?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello, Could anyone help me? I started using Laravel this year 2024 and I love it. I'm still taking courses, but recently I observed something strange. Whenever I create a breeze project and test the outcome, I get the following error: error at: @vite(['resources/css/app.css', 'resources/js/app.js']) I have tried to include bootstrap inclusion of vite but the problem doesn't go away. It has halted me in progression. I do not have such problems when I use Jetstream. Any help, please. I have included Bootstrap’s CSS and JS links but the problem doesn't disappear.
Thanks for the help.
Regards Bashiro
Which error do you exactly get?
Can you share the content of your vite.config file?
Thanks Gych, I get this message from guest.blade and app.blade
Here is the vite config file; import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin';
export default defineConfig({ plugins: [ laravel({ input: [ 'resources/css/app.css', 'resources/js/app.js', ], refresh: true, }), ], });
@bashiro Which error are you exactly getting?
just this?
error at: @vite(['resources/css/app.css', 'resources/js/app.js'])
@gych Yes just that coming from the guest.blade and app.blade. This happened only after installing Breeze and Blade.
@bashiro the correct line to add in app.blade.php is
@vite(['resources/css/app.js'])
you need to import resources/css/app.css in your resources/js/app.js file. that would solve your problem. i also suspect that you have added resources/js/app.css line manually.
Thanks Raj,
The import file is already in the vite config file input: [ 'resources/css/app.css', 'resources/js/app.js', ],
Any idea ? I have even added the following bootstrap css and js
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></
@bashiro you can just reference them in layout. and don't use classes from them. or if it just for some pages like login & registration. you can use blade template to render them. In fact you can combine view() and inertia() in same project. they don't interfare. just use view() to render blade templates.
@rajeshtva Thanks, I am so new so how do I reference them?
@bashiro i mean you can just put these in the head of your app.blade.php like you normally would. it won't cause any problem. but problem might occur when you have conflicting class names and configuration. i mean bootstrap has some css class which it applies to whole dom tree. in that style conflict would definitely occur.
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></
so i think you should focus on another approach, which is to create a separate layout(blade layout file). import bootstrap and css there in head. and use that layout in your login page. this would be neet.
If you are pulling bootstrap css and js from cdn and are not planning to compile modules, then you dont need vite at all and should remove it from layouts
@Snapey Thanks a lot. May be I have to create my own layout for the login page ? And by pass the guest and app blades ? I was thinking when they start to work then I can customize gradually. But May be I have to create my own pages and by pass them ? Thanks
By default breeze starter kit using Tailwind and setting up the development environment for you.
You need to have @vite(['resources/css/app.css', 'resources/js/app.js']) if you're using local Javascript and css files.
And you have to run npm i and npm run dev for the vite directive to work locally on development and npm run build for production.
After doing that, the error should go away.
But, if you aren't using local files and you're only using CDN, then you can remove the vite directive line.
I suggest to leave it and run npm i and then npm run dev while you're working.
You have to choose only one, either tailwind or bootstrap. Laravel recommends tailwind.
If you choose bootstrap, you will need to modify all Breeze views.
MORE EXPANATION: The thing is; After project creation/installation, I am able to visit the laravel page at localhost:8000. But when I try to login then I get these errors which are coming from the guest.blade and app.blade. Is this normal? And why don't this happen with jetstream ? From the advices above yes its because I want to use the register and login pages. Will you advice I find a way to create my own login blade pages ?
Thanks for any help. Regards Bashiro
Hello please do not get tired with me. I found out that the root error is from manifest.jason. It cannot find the manifest.jason file I get errors when building npm. Any idea ?
Solved the hard way. I had to copy "manifest.jason" from a previous project to "/public/build/manifest.jason" directory and the pages started working. Hence I can now create new login pages and ignore the rest. Thanks a lot for your contributions.
@bashiro Which results do you now get when you use npm run build?
@gych I get error t SyntaxError: Unexpected token 'export'. I have been getting this error after installing breeze
i created the same project under laravel 11 and no errors. So I do not know whether is a good idea to use laravel 11 as new bee or I should just continue with 10? I use visual code What will you recommend ?
@bashiro Something might have gone wrong when you installed 10 but you can continue to use Laravel 11, its the latest release and if you keep using 10 soon you'll have to upgrade to 11 anyways.
Does the SyntaxError error you were getting point you to a specific file where this error occurs?
@gych Thanks gych for the reply. This is the error I get when I creta e a laravel 10 project. Previousely it does not happen. I tried to create a project on a different laptop and it was the same error. I am behind PC with V code It looks like the PostCSS config ia also an issue
vite v4.5.2 building for production...
transforming...
(node:19384) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ... to show where the warning was created)
[Failed to load PostCSS config: Failed to load PostCSS config (searchPath: C:/laravel-courses/ver-10): [SyntaxError] Unexpected token 'export'
C:\laravel-courses\ver-10\postcss.config.js:1
export default {
^^^^^^
SyntaxError: Unexpected token 'export' at internalCompileFunction (node:internal/vm:77:18) at wrapSafe (node:internal/modules/cjs/loader:1288:20) at Module._compile (node:internal/modules/cjs/loader:1340:27) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at cjsLoader (node:internal/modules/esm/translators:356:17) at ModuleWrap. (node:internal/modules/esm/translators:305:7) at ModuleJob.run (node:internal/modules/esm/module_job:218:25) at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)]
Node.js v20.11.1
Add this to your package.json file
"type": "module",
Can you share the content of your postcss.config.js file?
@gych Thanks you very much. I added that and restarted Vcode . Then reinstalled breeze and manifest was created automatically. Then everything started working normal. Thank you very much. You've saved me headaches of days. Thanks. I can now continue with my tutorials.
@gych Here is the cotents of the postcss file export default { plugins: { tailwindcss: {}, autoprefixer: {}, }, };
@bashiro No problem :)
So now you don't get any errors when running npm run build?
@gych No I do not get any errors. It now works beautifully. Why is it that module if I may ask?
@bashiro It allowes you to use javascript ES6 (modules) and allows you to use import instead of require that was more used in the past.
Don't forget to mark your thread as solved by selecting the best answer. If you have more questions don't hesitate to reach out.
@vite(['resources/css/app.css', 'resources/js/app.js']) => Remove this and add following
I have used this and it's working perfectly. But it is a manual way, I think.
<script>
{!! Vite::content('resources/js/app.js') !!}
</script>
Please or to participate in this conversation.