Back to all fixes
CuratedTypeScriptVite 8local
Vite 8 Oxc minifier corrupts Monaco editor worker code (block-scoped function name collides with outer var)
Problem
After switching to Vite 8's default Oxc-based minifier, bundled code using Monaco Editor's web workers throws runtime errors that don't occur with esbuild minification. Root cause: a known Oxc mangler bug where the minifier doesn't account for Annex B block-scoped function declaration semantics in sloppy mode, letting it reuse the same mangled name for a block-scoped function and an outer `var` binding of the same original name, which changes runtime behavior.
Solution
typescript
Fixed upstream by oxc-project/oxc PR #20728, released in Oxc 0.123.0 / Rolldown 1.0.0-rc.13 / Vite v8.0.6 - upgrade to at least that version. If you cannot upgrade immediately, switch the minifier back to esbuild in vite.config.ts:
```ts
export default defineConfig({
build: { minify: 'esbuild' }
})
```
A user confirmed this workaround has negligible impact on build times while avoiding the Monaco corruption.