Public evidence: generated by OpenThunder’s keyless engine (no AI) from vitejs/vite@e16ff3a on 2026-07-21. Reproduce it: openthunder lens generate --no-narrate && openthunder lens export. ← Evidence Gallery

vite: Architecture

vite · e16ff3a11992 · generated 2026-07-21T00:12:24.916Z · static analysis

Architecture health: 30/100 (F)

Overview

vite is a JavaScript/TypeScript pnpm monorepo, built with React, Vue, Svelte, Vite, and Express. It runs as 9 frontends (test-alias, test-devtools, test-environment-react-ssr, test-extensions, test-external, test-json, test-legacy, test-optimize-deps, test-optimize-deps-no-discovery), 2 backend services (test-css-lightningcss-proxy, test-optimize-missing-deps), and 2 CLIs (test-cli, test-cli-module), backed by 64 shared packages. The main structural risks to watch: 15 oversized "god" files and 18 circular import chains. The file with the widest blast radius is packages/vite/src/node/utils.ts: 70 files depend on it at runtime; part of an import cycle; oversized and doing too much.

_This entire analysis runs on your machine with no AI required. Connect a model provider to also narrate the reasoning and recover decisions._

Where to start

  1. playground/css-lightningcss-proxy/ Start here: the primary entry point of the system.
  2. packages/vite/src/node/utils.ts Core module: 78 other modules depend on it, so it shapes much of the system.
  3. packages/vite/src/shared/utils.ts Core module: 58 other modules depend on it, so it shapes much of the system.
  4. packages/vite/src/node/config.ts Core module: 52 other modules depend on it, so it shapes much of the system.
  5. packages/vite/src/node/plugin.ts Core module: 40 other modules depend on it, so it shapes much of the system.
  6. playground/ssr-deps/src/app.js Key flow: Authentication, a high-risk path that enters at invoke app.js (playground/ssr-deps/src/app.js).
  7. packages/vite/src/module-runner/constants.ts Key flow: Mission execution, a high-risk path that enters at invoke constants.ts (packages/vite/src/module-runner/constants.ts).
  8. packages/create-vite/src/index.ts Key flow: File changes / writes, a high-risk path that enters at invoke index.ts (packages/create-vite/src/index.ts).
  9. packages/plugin-legacy/src/index.ts Key flow: Background jobs, a medium-risk path that enters at scheduled trigger (packages/plugin-legacy/src/index.ts).
  10. packages/vite/src/node/constants.ts Change with care: 31 files depend on it at runtime.

System map

flowchart TD
  subgraph sys_boundary["vite"]
    create_vite["create-vite"]
    plugin_legacy["plugin-legacy"]
    vite["vite"]
    test_legacy["test-legacy"]
    collapsed_units["73 more units, no cross-unit imports: vite-lit-starter, vite-lit-ts-starter, vite-preact-starter +70"]
  end
  create_vite -->|uses| vite
  test_legacy -->|uses| plugin_legacy
  class create_vite library
  class plugin_legacy library
  class vite library
  class test_legacy frontend
  class collapsed_units muted
  %% collapsed (no cross-unit imports): vite-lit-starter, vite-lit-ts-starter, vite-preact-starter, vite-preact-ts-starter, vite-qwik, vite-qwik, vite-react-starter, vite-react-typescript-starter, vite-solid-starter, vite-solid-typescript-starter, vite-svelte-starter, vite-svelte-ts-starter, vite-starter, vite-typescript-starter, vite-vue-starter, vite-vue-typescript-starter, types, test-alias, test-assets, test-assets-sanitize, test-backend-integration, test-base-conflict, test-build-old, test-chunk-importmap, test-cli, test-cli-module, test-client-reload, test-csp, test-css, test-css-codesplit, test-css-codesplit-cjs, test-css-lightningcss, test-css-lightningcss-proxy, test-css-lightningcss-root, test-css-no-codesplit, test-css-sourcemap, test-blue-app, test-green-app, test-data-uri, test-define, test-devtools, test-dynamic-import, test-dynamic-import-inline, test-env, test-env-nested, test-environment-react-ssr, test-extensions, test-external, test-forward-console, test-fs-serve, test-import-context, test-hmr, test-hmr-full-bundle-mode, test-hmr-ssr, test-html, test-import-attribute, test-js-sourcemap, test-json, test-my-lib, test-minify, test-hmr, test-multiple-entrypoints, test-nested-deps, test-object-hooks, test-optimize-deps, test-optimize-deps-no-discovery, test-optimize-missing-deps, test-preload, test-preserve-symlinks, test-proxy-bypass, test-proxy-hmr, test-other-app, test-resolve
  classDef frontend fill:#2563eb,stroke:#93c5fd,color:#fff,stroke-width:2px;
  classDef service fill:#059669,stroke:#6ee7b7,color:#fff,stroke-width:2px;
  classDef store fill:#d97706,stroke:#fcd34d,color:#fff,stroke-width:2px;
  classDef queue fill:#9333ea,stroke:#d8b4fe,color:#fff,stroke-width:2px;
  classDef job fill:#4f46e5,stroke:#a5b4fc,color:#fff,stroke-width:2px;
  classDef external fill:#475569,stroke:#cbd5e1,color:#fff,stroke-width:2px;
  classDef aiprovider fill:#e11d48,stroke:#fda4af,color:#fff,stroke-width:2px;
  classDef library fill:#0891b2,stroke:#67e8f9,color:#fff,stroke-width:2px;
  classDef cli fill:#0d9488,stroke:#5eead4,color:#fff,stroke-width:2px;
  classDef user fill:#64748b,stroke:#e2e8f0,color:#fff,stroke-width:2px;
  classDef muted fill:#334155,stroke:#64748b,color:#cbd5e1,stroke-width:1px;

Critical flows

Authentication high risk

Entry: invoke app.js (playground/ssr-deps/src/app.js)

Authentication guards every protected resource; a regression here can expose data or grant unauthorized access.

sequenceDiagram
  actor C0 as Caller
  participant F0 as app.js
  C0->>F0: invoke app.js

Mission execution high risk

Entry: invoke constants.ts (packages/vite/src/module-runner/constants.ts)

Mission execution drives autonomous code changes; errors here corrupt runs or the target repository.

sequenceDiagram
  actor C0 as Caller
  participant F0 as constants.ts
  participant F1 as importMeta.ts
  participant F2 as createImportMeta.ts
  participant F3 as esmEvaluator.ts
  participant F4 as evaluatedModules.ts
  participant F5 as hmrHandler.ts
  C0->>F0: invoke constants.ts

File changes / writes high risk

Entry: invoke index.ts (packages/create-vite/src/index.ts)

writes files to the working tree (disk)

Direct writes to the working tree are hard to reverse; an unguarded write can clobber user code.

sequenceDiagram
  actor C0 as Caller
  participant F0 as index.ts
  participant Disk as disk
  C0->>F0: invoke index.ts
  F0->>Disk: writes files to the working tree

Background jobs medium risk

Entry: scheduled trigger (packages/plugin-legacy/src/index.ts)

Background jobs run unattended; failures are silent and can pile up unnoticed.

sequenceDiagram
  actor C0 as Scheduler
  participant F0 as index.ts
  C0->>F0: scheduled trigger

Fragile zones

Architecture rules

blocking Change packages/vite/src/node/utils.ts with care: 70 files depend on it at runtime; part of an import cycle; oversized and doing too much. Preserve its public signatures, keep changes additive where possible, and run/extend its tests before and after.

This file has a wide blast radius (fan-in 78, fan-out 11, risk score 150.3); a careless edit ripples through many dependents.

blocking Change packages/vite/src/shared/utils.ts with care: 49 files depend on it at runtime. Preserve its public signatures, keep changes additive where possible, and run/extend its tests before and after.

This file has a wide blast radius (fan-in 58, fan-out 1, risk score 98.3); a careless edit ripples through many dependents.

blocking Change packages/vite/src/node/constants.ts with care: 31 files depend on it at runtime. Preserve its public signatures, keep changes additive where possible, and run/extend its tests before and after.

This file has a wide blast radius (fan-in 35, fan-out 1, risk score 63); a careless edit ripples through many dependents.

blocking Change packages/vite/src/node/config.ts with care: 7 files depend on it at runtime; types used by 33 modules; part of an import cycle; oversized and doing too much. Preserve its public signatures, keep changes additive where possible, and run/extend its tests before and after.

This file has a wide blast radius (fan-in 52, fan-out 32, risk score 62.3); a careless edit ripples through many dependents.

blocking Change playground/multiple-entrypoints/entrypoints/a23.js with care: 24 files depend on it at runtime; part of an import cycle. Preserve its public signatures, keep changes additive where possible, and run/extend its tests before and after.

This file has a wide blast radius (fan-in 24, fan-out 2, risk score 53.5); a careless edit ripples through many dependents.

blocking Change playground/multiple-entrypoints/entrypoints/a24.js with care: 24 files depend on it at runtime; part of an import cycle. Preserve its public signatures, keep changes additive where possible, and run/extend its tests before and after.

This file has a wide blast radius (fan-in 24, fan-out 1, risk score 53.3); a careless edit ripples through many dependents.

warning Do not add imports that deepen existing import cycles (e.g. packages/vite/src/node/build.ts → packages/vite/src/node/config.ts → packages/vite/src/node/server/index.ts → …). Break cycles when you touch the files involved.

Circular dependencies make modules impossible to reason about or test in isolation and cause load-order bugs.

advisory Do not add new responsibilities to oversized files (packages/vite/src/node/plugins/css.ts, packages/vite/src/node/config.ts, packages/vite/src/node/build.ts, packages/vite/src/node/server/index.ts, packages/vite/src/node/utils.ts); extract new logic into focused modules instead.

Large multi-purpose files are change magnets that accumulate coupling and resist testing; keeping them from growing limits the damage.

warning Respect package boundaries: import across packages via their published entry (e.g. the package name), not deep relative paths reaching into another package's internals.

Deep cross-package imports defeat the module boundary, make refactors brittle, and create hidden coupling the build graph cannot see.