Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

SmallDreams's avatar

Laravel @vite doesnt work in production

When working on my project locally, I 'run php artisan serve' and 'npm run dev', and everything works fine. However, when I deploy it to my production server (VPS), the CSS and Bootstrap stop working, and I only see a raw webpage without any styling.

I suspect that the production server isn't able to locate the CSS and Bootstrap files, but I'm not sure how to fix this. When I try to run 'npm run dev' on the VPS, I get an error.

Has anyone else experienced this issue? Or is there someone who could assist me with this? I would greatly appreciate any help.

Here's a snippet of my Vite setup:

@vite(['resources/css/main.css'])

<!-- Scripts -->
@vite(['resources/sass/app.scss', 'resources/js/app.js'])

When i run 'npm run build' i get this error in the prodcution server.

transforming (53) node_modules/@popperjs/core/lib/modifiers/hide.jsDeprecation Warning: Sass's behavior for declarations that appear after nested rules will be changing to match the behavior specified by CSS in an upcoming version. To keep the existing behavior, move the declaration above the nested rule. To opt into the new behavior, wrap the declaration in & {}.

0 likes
1 reply

Please or to participate in this conversation.