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

abhisheknayak_1111's avatar

Migrating from Laravel Mix to Vite in an Existing Project Using CommonJS

Hi everyone,

I'm currently using Laravel Mix in my project with the following versions:

"laravel-mix": "^6.0.0" Also tried the latest "^6.0.49" (beta) Running npm audit reports several moderate vulnerabilities, which is pushing me to consider switching to Laravel Vite for better long-term support and performance.

However, this is an existing project and my package.json setup uses CommonJS. Since Vite expects ES Modules, I'm running into compatibility issues during the migration. Even after conversion I am facing some issues which is in 2nd question

My questions:

1)Is there a way to use Laravel Vite in a project that still uses CommonJS in package.json?

2)After conversion using module and vite and in npm run dev everything is working correctly but in npm run build versioning is not working and icons are not getting loaded

Alternatively, is there a way to remove or mitigate the vulnerabilities reported by npm audit while continuing to use Laravel Mix?

Any guidance, tips, or shared experiences would be greatly appreciated!

Thanks in advance!

0 likes
1 reply

Please or to participate in this conversation.