Run vite build to deploy for production: by default it uses <root>/index.html as the build entry point and produces a bundle suitable for a static hosting service. The production bundle targets browsers compatible with Baseline Widely Available as of a date fixed per major release — Chrome >=111, Edge >=111, Firefox >=114, and Safari >=16.4 for the current major — customizable via the build.target option down to es2015, though Vite still requires browsers with native ESM dynamic import and import.meta. Vite handles syntax transforms only and does not cover polyfills; support legacy browsers with @vitejs/plugin-legacy, which generates legacy chunks and polyfills that load conditionally only in browsers without native ESM. Deploying under a nested public path needs only the base option or vite build --base=/my/public/path/; set "base": "./" when the base path is not known in advance. When a dynamic import fails, Vite emits a vite:preloadError event whose payload holds the original error and whose default can be prevented — useful after redeploys delete old assets, provided the HTML is served with Cache-Control: no-cache. vite build --watch rebuilds on file changes. Scope: Vite. Reviewed October 4, 2026.
Building for production
Document v1 · published by Koskamo editorial · updated 2026-10-04
Source and provenance
- Original source
- vite.dev
- Published on Koskamo by
- Koskamo editorial
- Citation version
- Document v1
- Reuse
- Original summaries; linked sources retain their own terms.