vitejs/vite architecture diagram
How vitejs/vite is built, drawn from its code at a579e35 on 2026-11-08 by Plotix's agent.
Core concepts
The main nouns of Vite's Node side: config, environments, plugins, module graph and dependency metadata.
Open the picture for full size (SVG).
Parts
- Config
root: string · command: serve | build · plugins: Plugin[] · environments: map - Environment
name: string · consumer: client | server · isBundled: boolean - Plugin
name: string · order: pre | normal | post · hooks: resolveId, load, transform - Module graph
urlToModule: map · idToModule: map · fileToModules: map - Module node
url: string · id: string | null · importers: Set · importedModules: Set - Dependency metadata
hash: string · browserHash: string · optimized: map
How they connect
- Config → Environment has
- Config → Plugin lists
- Environment → Module graph owns
- Environment → Dependency metadata caches
- Module graph → Module node holds
- Module node → Module node imports
Components
The runtime pieces of Vite and what calls what: CLI, dev server, plugin container, optimizer, build and HMR.
Open the picture for full size (SVG).
Parts
- Browser
- Vite CLI
vite dev, build, preview · parses flags - Config resolver
loads vite.config · loads .env files · builds environments - Dev server
HTTP and middlewares · serves index.html · proxy and static files - Transform middleware
serves JS, CSS, assets · calls transformRequest - Plugin container
runs resolveId, load, transform · hook order: pre, normal, post - Built-in plugins
resolve, css, oxc, json · asset, html, worker · import analysis - Module graph
module nodes by URL and file - HMR channel
WebSocket to the browser · sends update or full reload - Dependency optimizer
pre-bundles node_modules · caches by lockfile hash - Build engine
vite build entry point · runs the Rolldown bundle - SSR module runner
ssrLoadModule · runs modules in Node - Rolldown
How they connect
- Vite CLI → Config resolver loads config
- Vite CLI → Dev server vite dev
- Vite CLI → Build engine vite build
- Browser → Dev server GET /src/*
- Dev server → Transform middleware routes requests
- Transform middleware → Plugin container transform module
- Plugin container → Built-in plugins runs hooks
- Plugin container → Module graph registers modules
- Dev server → HMR channel
- HMR channel → Browser hmr update
- Dev server → Dependency optimizer pre-bundles deps
- Dependency optimizer → Rolldown bundles deps
- Build engine → Rolldown bundles app
- Dev server → SSR module runner ssrLoadModule
Dev request
What happens when the browser asks the dev server for one module.
Open the picture for full size (SVG).
Parts
- Browser
- Dev server
- Transform middleware
- Plugin container
- Module graph
How they connect
- Browser → Dev server GET /src/main.ts
- Dev server → Transform middleware transformRequest(url)
- Transform middleware → Module graph getModuleByUrl(url)
- Transform middleware → Plugin container resolveId, load, transform
- Plugin container → Module graph register module and importers
- Plugin container → Transform middleware transformed code
- Transform middleware → Dev server JS module
- Dev server → Browser 200 JavaScript
Build pipeline
How source files become the dist/ output in vite build.
Open the picture for full size (SVG).
Parts
- Config and env
vite.config.ts · .env files - Project sources
index.html entry · src/ modules · public/ assets - Plugin transforms
in: TS, JSX, CSS, Vue modules · out: ESM JavaScript - Rolldown bundle
in: ESM graph, HTML entry · out: chunks and assets - Minify and hash
in: chunks · out: hashed files - dist/ output
assets/ hashed files · index.html · manifest.json
How they connect
- Config and env → Plugin transforms
- Project sources → Plugin transforms
- Plugin transforms → Rolldown bundle
- Rolldown bundle → Minify and hash
- Minify and hash → dist/ output
Draw your own repo
Plotix's agent reads your code and draws its architecture, and the diagram warns you when the code moves on.
Try Plotix