Analyze Vite production artifacts
From source files to a deployable artifact
A production build converts the source module graph into files a browser can load. In a typical React/Vite SPA, index.html is an entry, TSX is transformed into JavaScript, and styles and imported assets are processed. Generated files may have content-dependent names to support caching. The development server is optimized for editing; Hot Module Replacement (HMR) updates modules, and React Fast Refresh can preserve component state when the update is compatible. Neither is a production hosting system. A preview server is for local inspection of the build, not a hardened public server.
A controlled build configuration
The following source uses Vite 7-style public configuration and the official React plugin as a proposed compatibility lane. Exact Vite/plugin/Node versions must be selected together from supported releases and pinned before installation. The local authoring environment has Node 22.16 and TypeScript 5.8.3, but no Vite or React package. The config is staged, not executed. The alias points to an absolute filesystem path, not a browser URL. Add a matching TypeScript paths configuration if using this alias in TSX. Plugins run code during tooling; only enable reviewed dependencies.
import {defineConfig} from 'vite';import react from '@vitejs/plugin-react';import {fileURLToPath, URL} from 'node:url';export default defineConfig({ base: '/workbench/', plugins: [react()], resolve: {alias: {'@': fileURLToPath(new URL('./src', import.meta.url))}}, server: {host: '127.0.0.1', strictPort: true}, preview: {host: '127.0.0.1', strictPort: true}, build: {manifest: true, sourcemap: false}});In an approved project, define scripts for vite, tsc --noEmit, vite build and vite preview. Run semantic type checking separately: stripping TypeScript syntax is not the same as checking types. Vite 7 uses a Rollup-based production bundler by default; later releases can differ. Do not copy bundler-specific plugin or chunk options without consulting the pinned version. A framework may instead generate server and client artifacts, and an older CRA/Webpack project has different env and output conventions.
Trace the output dependency graph
With a manifest enabled, inspect the generated mapping from source entries to emitted files. Static and dynamic import references are manifest keys; CSS and asset entries point to output files. A dynamic chunk missing from a release can leave the home page working while a later interaction fails. A file inventory should be generated from the same release; a manifest is not a cryptographic integrity proof. The helper below deliberately accepts a narrow path grammar and trusted manifest structure. It checks reachable references, not every unreferenced file.
// Inspect a trusted, already-parsed Vite-style manifest. No filesystem access.export function inspectManifest(manifest, files, entry = 'index.html') { const available = new Set(files); const issues = new Set(), visited = new Set(); const safePath = path => typeof path === 'string' && /^[A-Za-z0-9_./-]+$/.test(path) && path.split('/').every(part => part && part !== '.' && part !== '..'); function checkFile(file) { if (!safePath(file)) issues.add('Unsafe output path: ' + String(file)); else if (!available.has(file)) issues.add('Missing output: ' + file); } function visit(key) { if (visited.has(key)) return; visited.add(key); if (!Object.hasOwn(manifest, key)) {issues.add('Missing manifest key: ' + key); return;} const chunk = manifest[key]; checkFile(chunk.file); for (const file of [...(chunk.css ?? []), ...(chunk.assets ?? [])]) checkFile(file); for (const dep of [...(chunk.imports ?? []), ...(chunk.dynamicImports ?? [])]) visit(dep); } visit(entry); return [...issues].sort();}import {inspectManifest} from './inspect.mjs';export const manifest = { 'index.html': {file:'assets/main-a1.js', isEntry:true, css:['assets/main-b2.css'], dynamicImports:['src/Report.tsx']}, 'src/Report.tsx': {file:'assets/report-c3.js', isDynamicEntry:true, imports:['_shared.js']}, '_shared.js': {file:'assets/shared-d4.js'}};export const files = ['index.html','assets/main-a1.js','assets/main-b2.css','assets/report-c3.js','assets/shared-d4.js'];console.log(inspectManifest(manifest, files)); // []console.log(inspectManifest(manifest, files.filter(f => !f.includes('report-'))));// ['Missing output: assets/report-c3.js']The first output is an empty array, meaning no missing references were found. Removing the report chunk produces a specific missing-file issue. This fixture is not emitted by Vite. In a real build also inspect HTML references, byte sizes, file hashes, browser requests and the exact deployment artifact. An unreachable chunk can still require review; this graph check alone cannot certify a release.
Common mistakes and practice
Do not upload src/ instead of the generated output or mix a new HTML entry with an old asset set. Keep a versioned artifact with hashes and test the same artifact that is promoted. Practice: remove a CSS file from the synthetic inventory, then add an unresolved dynamic import. Explain why both should block release.