Dependency pre-bundling converts deps to ESM and reduces request waterfalls
Answer: The first time you run vite, Vite pre-bundles project dependencies before loading the site locally. This happens automatically and transparently by default. Dependency pre-bundling applies only in development mode.
This process serves two purposes. First, during development Vite serves all code as native ESM, so dependencies shipped as CommonJS or UMD must be converted to ESM. Vite also converts ESM dependencies with many internal modules into a single module. A package such as lodash-es can ship hundreds of internal files; pre-bundling it means the browser makes one request instead of many.
If no cache is found, Vite crawls your source and treats bare imports from node_modules as entry points for the pre-bundle.
In source
The include option forces listed dependencies to be optimized. The exclude option lists dependencies that must not be optimized. Those paths must be resolvable import paths, and exclude cannot be globs.
See also
Claims
- id: C1 claim: Vite pre-bundles project dependencies the first time you run vite. source: S1 evidence: "Vite prebundles your project dependencies before loading your site locally."
- id: C2 claim: Pre-bundling applies only in development mode. source: S1 evidence: "Dependency pre-bundling only applies in development mode."
- id: C3 claim: include forces listed dependencies to be optimized. source: S2 evidence: "Force optimize listed dependencies (must be resolvable import paths)."
- id: C4 claim: exclude lists dependencies that must not be optimized. source: S2 evidence: "Do not optimize these dependencies (must be resolvable import paths,"
Sources
- [S1] Dependency Pre-Bundling. Vite docs. https://vite.dev/guide/dep-pre-bundling . License: MIT. Accessed 2026-11-11.
- [S2] optimizer. Vite source. https://github.com/vitejs/vite/blob/main/packages/vite/src/node/optimizer/index.ts . License: MIT. Accessed 2026-11-11.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources and notices: Vite documentation and source (vitejs/vite): Copyright (c) 2019-present, VoidZero Inc. and Vite contributors; MIT (https://raw.githubusercontent.com/vitejs/vite/main/LICENSE). Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Vite docs and Vite source (vitejs/vite), MIT. Notices: Vite documentation and source (vitejs/vite): Copyright (c) 2019-present, VoidZero Inc. and Vite contributors; MIT (https://raw.githubusercontent.com/vitejs/vite/main/LICENSE).
Cite this
iinventedlight. 2026. "Vite pre-bundles dependencies in development for ESM and performance." iinventedlight Library, iil:note:vyy971wq, version of 2026-11-11. https://iinventedlight.com/library/notes/vite-dep-pre-bundling/. License: CC-BY-4.0.
@misc{iil_note_vyy971wq,
author = {{iinventedlight}},
title = {{Vite pre-bundles dependencies in development for ESM and performance}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-11},
url = {https://iinventedlight.com/library/notes/vite-dep-pre-bundling/},
note = {Permanent ID iil:note:vyy971wq. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/vite-dep-pre-bundling.md.