Skip to content

Commit 4a8aa82

Browse files
authored
feat!: bump build.target and name it baseline-widely-available (vitejs#20007)
1 parent 999a1ed commit 4a8aa82

File tree

18 files changed

+101
-54
lines changed

18 files changed

+101
-54
lines changed

docs/config/build-options.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Unless noted, the options in this section are only applied to build.
55
## build.target
66

77
- **Type:** `string | string[]`
8-
- **Default:** `'modules'`
8+
- **Default:** `'baseline-widely-available'`
99
- **Related:** [Browser Compatibility](/guide/build#browser-compatibility)
1010

11-
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_operators_import_meta) support. Vite will replace `'modules'` to `['es2020', 'edge88', 'firefox78', 'chrome87', 'safari14']`
11+
Browser compatibility target for the final bundle. The default value is a Vite special value, `'baseline-widely-available'`, which targets browsers that are included in the [Baseline](https://web-platform-dx.github.io/web-features/) Widely Available on 2025-05-01. Specifically, it is `['chrome107', 'edge107', 'firefox104', 'safari16']`.
1212

1313
Another special value is `'esnext'` - which assumes native dynamic imports support and will only perform minimal transpiling.
1414

docs/guide/build.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ When it is time to deploy your app for production, simply run the `vite build` c
44

55
## Browser Compatibility
66

7-
By default, the production bundle assumes support for modern JavaScript, such as [native ES Modules](https://caniuse.com/es6-module), [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import), [`import.meta`](https://caniuse.com/mdn-javascript_operators_import_meta), [nullish coalescing](https://caniuse.com/mdn-javascript_operators_nullish_coalescing), and [BigInt](https://caniuse.com/bigint). The default browser support range is:
7+
By default, the production bundle assumes a modern browser that is included in the [Baseline](https://web-platform-dx.github.io/web-features/) Widely Available targets. The default browser support range is:
88

9-
<!-- Search for the `ESBUILD_MODULES_TARGET` constant for more information -->
9+
<!-- Search for the `ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET` constant for more information -->
1010

11-
- Chrome >=87
12-
- Firefox >=78
13-
- Safari >=14
14-
- Edge >=88
11+
- Chrome >=107
12+
- Edge >=107
13+
- Firefox >=104
14+
- Safari >=16
1515

1616
You can specify custom targets via the [`build.target` config option](/config/build-options.md#build-target), where the lowest target is `es2015`. If a lower target is set, Vite will still require these minimum browser support ranges as it relies on [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import), and [`import.meta`](https://caniuse.com/mdn-javascript_operators_import_meta):
1717

docs/guide/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ You can learn more about the rationale behind the project in the [Why Vite](./wh
2222

2323
During development, Vite sets [`esnext` as the transform target](https://esbuild.github.io/api/#target), because we assume a modern browser is used and it supports all of the latest JavaScript and CSS features. This prevents syntax lowering, letting Vite serve modules as close as possible to the original source code.
2424

25-
For the production build, by default Vite targets browsers that support modern JavaScript, such as [native ES Modules](https://caniuse.com/es6-module), [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import), [`import.meta`](https://caniuse.com/mdn-javascript_operators_import_meta), [nullish coalescing](https://caniuse.com/mdn-javascript_operators_nullish_coalescing), and [BigInt](https://caniuse.com/bigint). 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.
25+
For production builds, Vite by default targets [Baseline](https://web-platform-dx.github.io/web-features/) Widely Available browsers. These are browsers that were released at least 2.5 years ago. The target can be lowered via configuration. Additionally, 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.
2626

2727
## Trying Vite Online
2828

packages/create-vite/template-lit-ts/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"compilerOptions": {
3-
"target": "ES2020",
3+
"target": "ES2022",
44
"experimentalDecorators": true,
55
"useDefineForClassFields": false,
66
"module": "ESNext",
7-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
88
"skipLibCheck": true,
99

1010
/* Bundler mode */

packages/create-vite/template-preact-ts/tsconfig.app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"compilerOptions": {
33
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4-
"target": "ES2020",
4+
"target": "ES2022",
55
"useDefineForClassFields": true,
66
"module": "ESNext",
7-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
88
"skipLibCheck": true,
99
"paths": {
1010
"react": ["./node_modules/preact/compat/"],

packages/create-vite/template-qwik-ts/tsconfig.app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"compilerOptions": {
33
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4-
"target": "ES2020",
4+
"target": "ES2022",
55
"useDefineForClassFields": true,
66
"module": "ESNext",
7-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
88
"skipLibCheck": true,
99

1010
/* Bundler mode */

packages/create-vite/template-react-ts/tsconfig.app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"compilerOptions": {
33
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4-
"target": "ES2020",
4+
"target": "ES2022",
55
"useDefineForClassFields": true,
6-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
6+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
77
"module": "ESNext",
88
"skipLibCheck": true,
99

packages/create-vite/template-solid-ts/tsconfig.app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"compilerOptions": {
33
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4-
"target": "ES2020",
4+
"target": "ES2022",
55
"useDefineForClassFields": true,
66
"module": "ESNext",
7-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
88
"skipLibCheck": true,
99

1010
/* Bundler mode */

packages/create-vite/template-svelte-ts/tsconfig.app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "@tsconfig/svelte/tsconfig.json",
33
"compilerOptions": {
4-
"target": "ESNext",
4+
"target": "ES2022",
55
"useDefineForClassFields": true,
66
"module": "ESNext",
77
"resolveJsonModule": true,

packages/create-vite/template-vanilla-ts/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"compilerOptions": {
3-
"target": "ES2020",
3+
"target": "ES2022",
44
"useDefineForClassFields": true,
55
"module": "ESNext",
6-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
6+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
77
"skipLibCheck": true,
88

99
/* Bundler mode */

0 commit comments

Comments
 (0)