If you are migrating from
rolldown-vite, the technical preview release for Rolldown integrated Vite for v6 & v7, only the sections with NRV badge in the title are applicable.Default Browser Target Change
The default browser value ofbuild.target and 'baseline-widely-available', is updated to newer browser version:
- Chrome 107 → 111
- Edge 107 → 111
- Firefox 104 → 114
- Safari 16.0 → 16.4
Rolldown
Vite 8 uses Rolldown and Oxc based tools instead of esbuild and Rollup.Gradual Migration
Therolldown-vite package implements Vite 7 with Rolldown, without other Vite 8 changes. This can be used as a intermediate step to migrate to Vite 8. See the Rolldown Integration guide in the Vite 7 docs to switch to rolldown-vite from Vite 7.
Dependency Optimizer Now Uses Rolldown
Rolldown is now used for dependency optimization instead of esbuild. Vite still supportsoptimizeDeps.esbuildOptions for backward compatibility by converting it to optimizeDeps.rolldownOptions automatically. optimizeDeps.esbuildOptions is now deprecated and will be removed in the future and we encourage you to migrate to optimizeDeps.rolldownOptions.
Automatically converted options
Automatically converted options
The following options are converted automatically:
esbuildOptions.minify→rolldownOptions.output.minifyesbuildOptions.treeShaking→rolldownOptions.treeshakeesbuildOptions.define→rolldownOptions.transform.defineesbuildOptions.loader→rolldownOptions.moduleTypesesbuildOptions.preserveSymlinks→!rolldownOptions.resolve.symlinksesbuildOptions.resolveExtensions→rolldownOptions.resolve.extensionsesbuildOptions.mainFields→rolldownOptions.resolve.mainFieldsesbuildOptions.conditions→rolldownOptions.resolve.conditionNamesesbuildOptions.keepNames→rolldownOptions.output.keepNamesesbuildOptions.platform→rolldownOptions.platformesbuildOptions.plugins→rolldownOptions.plugins(partial support)
JavaScript Transforms by Oxc
Oxc is now used for JavaScript transformation instead of esbuild. Vite still supports theesbuild option for backward compatibility by converting it to oxc automatically. esbuild is now deprecated and will be removed in the future and we encourage you to migrate to oxc.
Automatically converted options
Automatically converted options
The following options are converted automatically:
esbuild.jsxInject→oxc.jsxInjectesbuild.include→oxc.includeesbuild.exclude→oxc.excludeesbuild.jsx→oxc.jsxesbuild.jsx: 'preserve'→oxc.jsx: 'preserve'esbuild.jsx: 'automatic'→oxc.jsx: { runtime: 'automatic' }esbuild.jsxImportSource→oxc.jsx.importSource
esbuild.jsx: 'transform'→oxc.jsx: { runtime: 'classic' }esbuild.jsxFactory→oxc.jsx.pragmaesbuild.jsxFragment→oxc.jsx.pragmaFrag
esbuild.jsxDev→oxc.jsx.developmentesbuild.jsxSideEffects→oxc.jsx.pure
esbuild.define→oxc.defineesbuild.banner→ custom plugin using transform hookesbuild.footer→ custom plugin using transform hook
Currently, the Oxc transformer does not support lowering native decorators as we are waiting for the specification to progress, see (oxc-project/oxc#9170).
Workaround for lowering native decorators
Workaround for lowering native decorators
You can use Babel or SWC to lower native decorators for the time being. While SWC is faster than Babel, it does not support the latest decorator spec that esbuild supports.The decorator spec has been updated multiple times since it reached stage 3. The versions supported by each tool are:
"2023-11"(esbuild, TypeScript 5.4+ and Babel support this version)"2023-05"(TypeScript 5.2+ supports this version)"2023-01"(TypeScript 5.0+ supports this version)"2022-03"(SWC supports this version)
esbuild Fallbacks
esbuild is no longer directly used by Vite and is now an optional dependency. If you are using a plugin that uses the transformWithEsbuild function, you need to install esbuild as a devDependency. The transformWithEsbuild function is deprecated and will be removed in the future. We recommend migrating to the new transformWithOxc function instead.
JavaScript Minification by Oxc
The Oxc Minifier is now used for JavaScript minification instead of esbuild. You can use the deprecatedbuild.minify: 'esbuild' option to switch back to esbuild. This configuration option will be removed in the future and you need install esbuild as a devDependency as Vite no longer relies on esbuild directly.
If you were using the esbuild.minify* options to control minification behavior, you can now use build.rolldownOptions.output.minify instead. If you were using the esbuild.drop option, you can now use build.rolldownOptions.output.minify.compress.drop* options.
esbuild and Oxc Minifier make slightly different assumptions about source code. In case you suspect the minifier is causing breakage in your code, you can compare these assumptions here:
Please report any issues you find related to minification in your JavaScript apps.
CSS Minification by Lightning CSS
Lightning CSS is now used for CSS minification by default. You can use thebuild.cssMinify: 'esbuild' option to switch back to esbuild. Note that you need to install esbuild as a devDependency.
Lightning CSS supports better syntax lowering and your CSS bundle size might increase slightly.
Consistent CommonJS Interop
Thedefault import from a CommonJS (CJS) module is now handled in a consistent way.
If it matches one of the following conditions, the default import is the module.exports value of the importee CJS module. Otherwise, the default import is the module.exports.default value of the importee CJS module:
- The importer is
.mjsor.mts. - The closest
package.jsonfor the importer has atypefield set tomodule. - The
module.exports.__esModulevalue of the importee CJS module is not set to true.
Removed Module Resolution Using Format Sniffing
When bothbrowser and module fields are present in package.json, Vite used to resolve the field based on the content of the file and it used to pick the ESM file for browsers. This was introduced because some packages were using the module field to point to ESM files for Node.js and some other packages were using the browser field to point to UMD files for browsers. Given that the modern exports field solved this problem and is now adopted by many packages, Vite no longer uses this heuristic and always respects the order of the resolve.mainFields option. If you were relying on this behavior, you can use the resolve.alias option to map the field to the desired file or apply a patch with your package manager (e.g. patch-package, pnpm patch).
Require Calls For Externalized Modules
require calls for externalized modules are now preserved as require calls and not converted to import statements. This is to preserve the semantics of require calls. If you want to convert them to import statements, you can use Rolldown’s built-in esmExternalRequirePlugin, which is re-exported from vite.
vite.config.js
require external modules - Bundling CJS | Rolldown.
import.meta.url in UMD / IIFE
import.meta.url is no longer polyfilled in UMD / IIFE output formats. It will be replaced with undefined by default. If you prefer the previous behavior, you can use the define option with build.rolldownOptions.output.intro option. See Rolldown’s docs for more details: Well-known import.meta properties - Non ESM Output Formats | Rolldown.
Removed build.rollupOptions.watch.chokidar option
The build.rollupOptions.watch.chokidar option was removed. Please migrate to the build.rolldownOptions.watch.notify option.
Removed object form build.rollupOptions.output.manualChunks
The object form output.manualChunks option is not supported anymore. The function form output.manualChunks is deprecated. Rolldown has the more flexible codeSplitting option. See Rolldown’s docs for more details about codeSplitting: Manual Code Splitting - Rolldown.
Module Type Support and Auto Detection
This change only affects plugin authors.
loader option. Due to this, Rolldown automatically sets a module type based on the extension of the resolved id. If you are converting content from other module types to JavaScript in load or transform hooks, you may need to add moduleType: 'js' to the returned value:
Other Related Deprecations
The following options are deprecated and will be removed in the future:build.rollupOptions: renamed tobuild.rolldownOptionsworker.rollupOptions: renamed toworker.rolldownOptionsbuild.commonjsOptions: it is now no-opbuild.dynamicImportVarsOptions.warnOnError: it is now no-opresolve.alias[].customResolver: Use a custom plugin withresolveIdhook andenforce: 'pre'instead
Removed Deprecated Features
- Passing an URL to
import.meta.hot.acceptis no longer supported. Please pass an id instead. (#21382)
Advanced
Extglobs not supported yet
Extglobs not supported yet
Extglobs are not supported yet (rolldown-vite#365)
TypeScript legacy namespace partial support
TypeScript legacy namespace partial support
TypeScript legacy namespace is only supported partially. See Oxc Transformer’s related documentation for more details.
define does not share reference for objects
define does not share reference for objects
bundle object changes
bundle object changes
bundle object changes (bundle is an object passed in generateBundle / writeBundle hooks, returned by build function):- Assigning to
bundle[foo]is not supported. This is discouraged by Rollup as well. Please usethis.emitFile()instead. - The reference is not shared across the hooks (rolldown-vite#410)
structuredClone(bundle)errors withDataCloneError: #<Object> could not be cloned. This is not supported anymore. Please clone it withstructuredClone({ ...bundle }). (rolldown-vite#128)
Parallel hooks work as sequential hooks
Parallel hooks work as sequential hooks
All parallel hooks in Rollup works as sequential hooks. See Rolldown’s documentation for more details.
use strict not injected sometimes
use strict not injected sometimes
"use strict"; is not injected sometimes. See Rolldown’s documentation for more details.plugin-legacy ES5 support
plugin-legacy ES5 support
Transforming to lower than ES5 with plugin-legacy is not supported (rolldown-vite#452)
Multiple browser versions error
Multiple browser versions error
Passing the same browser with multiple versions of it to
build.target option now errors: esbuild selects the latest version of it, which was probably not what you intended.Missing support by Rolldown
Missing support by Rolldown
The following features are not supported by Rolldown and is no longer supported by Vite:
build.rollupOptions.output.format: 'system'(rolldown#2387)build.rollupOptions.output.format: 'amd'(rolldown#2387)shouldTransformCachedModulehook (rolldown#4389)resolveImportMetahook (rolldown#1010)renderDynamicImporthook (rolldown#4532)resolveFileUrlhook
parseAst deprecated
parseAst deprecated
parseAst / parseAstAsync functions are now deprecated in favor of parseSync / parse functions which have more features.@vite-ignore comment edge case
@vite-ignore comment edge case
(bug)
@vite-ignore comment edge case (rolldown-vite#426)