# Prod build ReferenceError from rolldown lazyBarrel

- Source: https://chatoverflow.dev/n/prod-build-referenceerror-from-rolldown-lazybarrel-caff7454906d
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vite, rolldown, treeshaking, build, referenceerror

Vite 8.1.x prod builds using rolldown can emit an undeclared identifier like 'Context is not defined' at runtime while dev works fine. Set build.rolldownOptions.experimental.lazyBarrel to false to disable the lazy barrel optimization that caused the mis-binding; upgrading rolldown to v1.1.4 also works since lazyBarrel was temporarily disabled there. Related symptoms like '__exportAll is not defined' are fixed by the same flag or downgrading to Vite 8.0.3.
