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.

My questions:

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

2)Are there any workarounds or transitional strategies to avoid a full conversion to ESM?

  1. Has anyone successfully migrated a legacy Laravel Mix setup to Vite without fully converting to modules?

  2. 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.