← All unpacks
CodeVetter · Repo Unpack comparison

vite vs webpack

vite scanned at 1544bb1 (2026-09-22) · webpack at 87a62de (2026-09-22) · codevetter codevetter 1.12.0

Vite's on-demand ESM dev server vs webpack's bundle-first graph — two generations of frontend build architecture.

vitejs/vitewebpack/webpack
Files scanned27183999
Size5.6 MB15.0 MB
Primary source rootpackages/lib/
Top languageJavaScript (979 files)JavaScript (16040 files)
Package@vitejs/vite-monorepo v—webpack v5.111.1
Structural health7/10 avg, 36 hotspots6.5/10 avg, 47 hotspots
Test signalmissingmissing

Architectures

vite

This is the Vite monorepo (`@vitejs/vite-monorepo`) at v8.3.0 — a pnpm workspace shipping three published packages: `vite` (the native-ESM dev server + Rolldown-powered bundler), `create-vite` (the scaffolding CLI), and `@vitejs/plugin-legacy` (SystemJS/Babel downlevel output for old browsers). The `vite` package is the bulk of it: a `cac`-driven CLI over four commands (dev/build/optimize/preview), a `connect` middleware stack that transforms modules on demand and pushes HMR over an authenticated WebSocket, and a Rollup-compatible plugin container that now runs on Rolldown/Oxc rather than Rollup+esbuild. What's distinctive at this commit is the Environment API — dev and build are both fanned out across named environments (`client`, `ssr`, custom) each with its own module graph, plugin container and optimizer — plus an experimental `bundledDev` mode that swaps the per-module transform pipeline for a lazy Rolldown dev bundle served from memory. Correctness is enforced almost entirely by a 83-playground / 109-spec Playwright+Vitest integration suite that runs every fixture in serve, bundled-dev, and build modes.

webpack

webpack is the JavaScript module bundler (v5.111.1, MIT, `main: lib/index.js`, CLI at `bin/webpack.js`): a `Compiler` builds a module graph from entry dependencies, a `Compilation` seals that graph into chunks, and the result is emitted as static assets for web, Node, worker, Deno, Bun, Electron and universal targets. Everything is `tapable` hooks over CommonJS + JSDoc source — the public config API is defined by JSON Schema in `schemas/` and every type, validator and declaration is code-generated from it by `tooling/generate-types.js`. What is distinctive about this tree is how much webpack now owns itself: its own acorn-derived ECMAScript parser (`lib/javascript/syntax-parser.js`, 17.8k lines), its own CSS and HTML parser/printer/minifier pairs, generated lookup-table modules (`lib/{css,html,javascript}/data.js`), and a comparison harness in `tooling/` that benchmarks those against the ecosystem and gates printer invariants in CI. It is aimed at application developers via config, and at the plugin/loader ecosystem via ~100 exported classes and several hundred hooks.

System maps

vite

Three publishable packages under `packages/`, a 83-directory `playground/` that doubles as the integration test corpus, and a VitePress `docs/` site deployed to Netlify. The `vite` package's runtime splits four ways: `src/node` (server, build, config, plugins — Node only), `src/client` (browser HMR client and error overlay), `src/module-runner` (SSR/runtime module evaluation), and `src/shared` (code compiled into both sides). All bundling — of Vite itself, of user configs, of dep pre-bundles, and of production output — goes through Rolldown; Rollup remains only as a type source and devDependency. There is no database or persistent store; the only on-disk state is the dep-optimizer cache under `cacheDir` and build output under `outDir`.

webpack

The public surface is `lib/index.js` — a lazily-evaluated getter object exporting the `webpack()` factory plus ~100 plugin/class names and namespaced sub-objects (`webpack.cli`, `webpack.javascript.syntax`, `webpack.container`, `webpack.sharing`). `lib/webpack.js` normalizes, defaults and validates options, constructs a `Compiler`, and hands off to `WebpackOptionsApply`, which is the single place that translates resolved options into the ~60 plugins a build implies. Runtime boundaries are the filesystem (`lib/fs/fs.js` declares `InputFileSystem`/`OutputFileSystem`, `NodeEnvironmentPlugin` supplies the Node implementations), the loader sandbox (`lib/loaders/LoaderRunner.js`), and optional network I/O (`lib/schemes/HttpUriPlugin.js`, `lib/hmr/lazyCompilationBackend.js`). Persistence is the filesystem cache pack under `lib/cache/` plus the custom binary serializer in `lib/serialization/`. Build/test is all yarn scripts in `package.json`, and CI is 13 GitHub Actions workflows with `test.yml` as the hub.

Repository structure

vite

  • playground/ — 1756 files
  • packages/ — 797 files
  • docs/ — 116 files
  • .github/ — 24 files
  • scripts/ — 8 files
  • patches/ — 3 files

webpack

  • test/ — 2199 files
  • lib/ — 771 files
  • examples/ — 763 files
  • schemas/ — 122 files
  • .changeset/ — 42 files
  • tooling/ — 25 files
  • .github/ — 21 files
  • hot/ — 12 files