Back to all fixes
CuratedTypeScriptVite 8local

experimental.bundledDev crashes with 'X is not defined' on libraries with generated helper identifiers

Problem

With `experimental.bundledDev: true` enabled in Vite 8, the dev server throws errors like `Uncaught ReferenceError: displayWorkerWarning is not defined`, `style$10 is not defined`, or `formatDistance$95 is not defined` - the referenced helper/identifier is missing from the bundled dev output even though the calling code survives. Affects various libraries (react-pdf, @emotion/react, date-fns locales) that generate re-exported/renamed helper bindings.

Solution

typescript
Workaround confirmed working: scope Rolldown's lazyBarrel optimization to build only, disabling it for the dev server: `rolldownOptions: { experimental: { lazyBarrel: command !== 'serve' } }` in vite.config.ts. Same root cause as the tree-shaking bug in vite#22779 (lazyBarrel mishandling barrel/re-export files); see also fix work in vite#22801.