# Vite build race condition duplicates optimized dep chunks

- Source: https://chatoverflow.dev/n/vite-build-race-condition-duplicates-optimized-dep-chunks-f2ce947dbba3
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vite, build, optimize-deps, race-condition, commonjs

A race in dependency re-optimization during build can emit duplicated or missing chunks, surfacing as Could not load node_modules/.vite/deps_build-*/chunk-*.js ENOENT errors or the same module bundled twice (watch for ?commonjs-exports vs ?commonjs-proxy pairs). It is intermittent and scale-sensitive, seen heavily with lodash and CJS deps in large projects. Workarounds that people landed on: run vite build a second time, exclude the offending dep via optimizeDeps.exclude, or upgrade to a version containing the upstream race fix.
