diff --git a/docs/config/build-options.md b/docs/config/build-options.md index f2c9598f752ada..8a32b1c691c62e 100644 --- a/docs/config/build-options.md +++ b/docs/config/build-options.md @@ -6,7 +6,7 @@ - **Default:** `'modules'` - **Related:** [Browser Compatibility](/guide/build#browser-compatibility) -Browser compatibility target for the final bundle. The default value is a Vite special value, `'modules'`, which targets browsers with [native ES Modules](https://caniuse.com/es6-module) and [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import) support. +Browser compatibility target for the final bundle. The default value is a Vite special value, `'modules'`, which targets browsers with [native ES Modules](https://caniuse.com/es6-module), [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import), and [`import.meta`](https://caniuse.com/mdn-javascript_statements_import_meta) support. Another special value is `'esnext'` - which assumes native dynamic imports support and will transpile as little as possible: diff --git a/docs/guide/build.md b/docs/guide/build.md index 149741df08c753..44bd39c4baa681 100644 --- a/docs/guide/build.md +++ b/docs/guide/build.md @@ -4,7 +4,7 @@ When it is time to deploy your app for production, simply run the `vite build` c ## Browser Compatibility -The production bundle assumes support for modern JavaScript. By default, Vite targets browsers which support the [native ES Modules](https://caniuse.com/es6-module) and [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import) and [`import.meta`](https://caniuse.com/mdn-javascript_statements_import_meta): +The production bundle assumes support for modern JavaScript. By default, Vite targets browsers which support the [native ES Modules](https://caniuse.com/es6-module), [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import), and [`import.meta`](https://caniuse.com/mdn-javascript_statements_import_meta): - Chrome >=87 - Firefox >=78 diff --git a/docs/guide/index.md b/docs/guide/index.md index d7657d15e61fda..ceda2c7632771b 100644 --- a/docs/guide/index.md +++ b/docs/guide/index.md @@ -18,7 +18,7 @@ You can learn more about the rationale behind the project in the [Why Vite](./wh ## Browser Support -The default build targets browsers that support both [native ES Modules](https://caniuse.com/es6-module) and [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import). Legacy browsers can be supported via the official [@vitejs/plugin-legacy](https://github.com/vitejs/vite/tree/main/packages/plugin-legacy) - see the [Building for Production](./build) section for more details. +The default build targets browsers that support [native ES Modules](https://caniuse.com/es6-module), [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import), and [`import.meta`](https://caniuse.com/mdn-javascript_statements_import_meta). Legacy browsers can be supported via the official [@vitejs/plugin-legacy](https://github.com/vitejs/vite/tree/main/packages/plugin-legacy) - see the [Building for Production](./build) section for more details. ## Trying Vite Online diff --git a/docs/guide/migration.md b/docs/guide/migration.md index aa082c57b8ba0d..5ad94a84ca6152 100644 --- a/docs/guide/migration.md +++ b/docs/guide/migration.md @@ -6,7 +6,7 @@ Vite no longer supports Node.js 12 / 13 / 15, which reached its EOL. Node.js 14. ## Modern Browser Baseline change -The production bundle assumes support for modern JavaScript. By default, Vite targets browsers which support the [native ES Modules](https://caniuse.com/es6-module) and [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import) and [`import.meta`](https://caniuse.com/mdn-javascript_statements_import_meta): +The production bundle assumes support for modern JavaScript. By default, Vite targets browsers which support the [native ES Modules](https://caniuse.com/es6-module), [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import), and [`import.meta`](https://caniuse.com/mdn-javascript_statements_import_meta): - Chrome >=87 - Firefox >=78 diff --git a/packages/vite/src/node/constants.ts b/packages/vite/src/node/constants.ts index b5fb126e97beaa..35bf9231909850 100644 --- a/packages/vite/src/node/constants.ts +++ b/packages/vite/src/node/constants.ts @@ -11,8 +11,9 @@ export const DEFAULT_MAIN_FIELDS = [ 'jsnext' ] -// Support browserslist -// "defaults and supports es6-module and supports es6-module-dynamic-import", +// Baseline support browserslist +// "defaults and supports es6-module and supports es6-module-dynamic-import" +// Higher browser versions may be needed for extra features. export const ESBUILD_MODULES_TARGET = [ 'es2020', // support import.meta.url 'edge88',