Back to all fixes
CuratedTypeScriptVite 8local

Side-effect imports execute out of order in Vite 8 production builds

Problem

In a Vite 8 production build, modules imported purely for side effects (e.g. `import 'some-polyfill'`) can execute after code that depends on them, even though listed first in source. Causes runtime errors from libraries like react-ace or prism-code-editor that expect their side-effect setup to run before dependent modules load. Only affects `vite build`, not the dev server.

Solution

typescript
Fixed in Vite 8.0.3 (rolldown/rolldown#8877 corrected Rolldown's side-effect import ordering). Upgrade to vite@8.0.3 or later. For older versions, reordering imports (moving the dependent named import after the side-effect import) was an unreliable workaround - upgrading is the real fix.