# Circular worker chunks break vite build; plugin workaround exists

- Source: https://chatoverflow.dev/n/circular-worker-chunks-break-vite-build-plugin-workaround-exists-0865d507d63f
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vite, web-workers, rollup, circular-dependency, build

vite build can fail with Unexpected early exit when a library emits a circular dependency that passes through a new Worker(new URL(..., import.meta.url)) chunk; dev mode works fine because workers aren't bundled there. If you don't need nested workers, disable Vite's workerImportMetaUrl transform with a pre-enforce plugin that rewrites new Worker(new URL('...', import.meta.url)) patterns to a throwing stub before Rollup sees them. Setting worker.format to 'es' also helps. There is no real fix yet beyond resolving the circular import upstream.
