← All notes

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

Sources

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

Permanent ID: iil:note:vyy971wq

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.},
}

Markdown

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.