Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build!: bump targets #8045

Merged
merged 7 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ export default defineConfig({

Another special value is `'esnext'` - which assumes native dynamic imports support and will transpile as little as possible:

- If the [`build.minify`](#build-minify) option is `'terser'`, `'esnext'` will be forced down to `'es2019'`.
- If the [`build.minify`](#build-minify) option is `'terser'`, `'esnext'` will be forced down to `'es2021'`.
- In other cases, it will perform no transpilation at all.

The transform is performed with esbuild and the value should be a valid [esbuild target option](https://esbuild.github.io/api/#target). Custom targets can either be a ES version (e.g. `es2015`), a browser with version (e.g. `chrome58`), or an array of multiple target strings.
Shinigami92 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
6 changes: 3 additions & 3 deletions packages/create-vite/template-lit-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "esnext",
"lib": ["es2017", "dom", "dom.iterable"],
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
Shinigami92 marked this conversation as resolved.
Show resolved Hide resolved
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "./types",
Expand All @@ -10,7 +10,7 @@
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"moduleResolution": "Node",
"isolatedModules": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/create-vite/template-lit-ts/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"composite": true,
"module": "esnext",
"moduleResolution": "node"
"module": "ESNext",
"moduleResolution": "Node"
},
"include": ["vite.config.ts"]
}
4 changes: 2 additions & 2 deletions packages/create-vite/template-preact-ts/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"composite": true,
"module": "esnext",
"moduleResolution": "node"
"module": "ESNext",
"moduleResolution": "Node"
},
"include": ["vite.config.ts"]
}
4 changes: 2 additions & 2 deletions packages/create-vite/template-react-ts/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"composite": true,
"module": "esnext",
"moduleResolution": "node"
"module": "ESNext",
"moduleResolution": "Node"
},
"include": ["vite.config.ts"]
}
4 changes: 2 additions & 2 deletions packages/create-vite/template-svelte-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "@tsconfig/svelte/tsconfig.json",
"compilerOptions": {
"target": "esnext",
"target": "ESNext",
"useDefineForClassFields": true,
"module": "esnext",
"module": "ESNext",
"resolveJsonModule": true,
"baseUrl": ".",
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/create-vite/template-svelte-ts/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"composite": true,
"module": "esnext",
"moduleResolution": "node"
"module": "ESNext",
"moduleResolution": "Node"
},
"include": ["vite.config.ts"]
}
6 changes: 3 additions & 3 deletions packages/create-vite/template-svelte/jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"moduleResolution": "node",
"target": "esnext",
"module": "esnext",
"moduleResolution": "Node",
"target": "ESNext",
"module": "ESNext",
/**
* svelte-preprocess cannot figure out whether you have
* a value or a type, so tell TypeScript to enforce using
Expand Down
8 changes: 4 additions & 4 deletions packages/create-vite/template-vue-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"compilerOptions": {
"target": "esnext",
"target": "ESNext",
"useDefineForClassFields": true,
"module": "esnext",
"moduleResolution": "node",
"module": "ESNext",
"moduleResolution": "Node",
"strict": true,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"],
"lib": ["ESNext", "DOM"],
"skipLibCheck": true
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
Expand Down
4 changes: 2 additions & 2 deletions packages/create-vite/template-vue-ts/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"composite": true,
"module": "esnext",
"moduleResolution": "node"
"module": "ESNext",
"moduleResolution": "Node"
},
"include": ["vite.config.ts"]
}
2 changes: 1 addition & 1 deletion packages/plugin-legacy/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"exclude": ["**/*.spec.ts"],
"compilerOptions": {
"outDir": "dist",
"target": "ES2018",
"target": "ES2020",
"module": "CommonJS",
"moduleResolution": "Node",
"strict": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"exclude": ["**/*.spec.ts"],
"compilerOptions": {
"outDir": "dist",
"target": "ES2018",
"target": "ES2020",
"module": "CommonJS",
"moduleResolution": "Node",
"strict": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-vue-jsx/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"exclude": ["**/*.spec.ts"],
"compilerOptions": {
"outDir": "dist",
"target": "ES2018",
"target": "ES2020",
"module": "CommonJS",
"moduleResolution": "Node",
"strict": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-vue/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"exclude": ["**/*.spec.ts"],
"compilerOptions": {
"outDir": "dist",
"target": "ES2019",
"target": "ES2020",
"module": "commonjs",
"moduleResolution": "node",
"strict": true,
Expand Down
6 changes: 3 additions & 3 deletions packages/vite/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const envConfig = {
input: path.resolve(__dirname, 'src/client/env.ts'),
plugins: [
typescript({
target: 'es2018',
target: 'es2020',
include: ['src/client/env.ts'],
baseUrl: path.resolve(__dirname, 'src/env'),
paths: {
Expand All @@ -41,7 +41,7 @@ const clientConfig = {
external: ['./env', '@vite/env'],
plugins: [
typescript({
target: 'es2018',
target: 'es2020',
include: ['src/client/**/*.ts'],
baseUrl: path.resolve(__dirname, 'src/client'),
paths: {
Expand Down Expand Up @@ -128,7 +128,7 @@ const createNodeConfig = (isProduction) => {
typescript({
tsconfig: 'src/node/tsconfig.json',
module: 'esnext',
target: 'es2019',
target: 'es2020',
include: ['src/**/*.ts', 'types/**'],
exclude: ['src/**/__tests__/**'],
esModuleInterop: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"include": ["./", "../../types"],
"compilerOptions": {
"outDir": "../../dist/client",
"module": "esnext",
"module": "ESNext",
"types": [],
"lib": ["ESNext", "DOM"],
"declaration": false
Expand Down
4 changes: 2 additions & 2 deletions packages/vite/src/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ export function resolveBuildOptions(raw?: BuildOptions): ResolvedBuildOptions {
'safari13' // transpile nullish coalescing
]
} else if (resolved.target === 'esnext' && resolved.minify === 'terser') {
// esnext + terser: limit to es2019 so it can be minified by terser
resolved.target = 'es2019'
// esnext + terser: limit to es2021 so it can be minified by terser
resolved.target = 'es2021'
}

if (!resolved.cssTarget) {
Expand Down
6 changes: 2 additions & 4 deletions packages/vite/src/node/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
"include": ["./", "../../types"],
"exclude": ["**/__tests__"],
"compilerOptions": {
// compile away optional-chaining-operator
// node support table: https://node.green/#ES2020-features-optional-chaining-operator-----
"target": "ES2019",
"target": "ES2020",
"outDir": "../../dist/node",
"module": "commonjs",
"module": "CommonJS",
"lib": ["ESNext", "DOM"],
"sourceMap": true
}
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "ES2018",
"target": "ES2020",
"moduleResolution": "node",
"strict": true,
"declaration": true,
Expand Down
6 changes: 3 additions & 3 deletions playground/hmr/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"include": ["."],
"exclude": ["**/dist/**", "**/__tests__/**"],
"compilerOptions": {
"target": "es2019",
"module": "esnext",
"target": "ES2020",
"module": "ESNext",
"outDir": "dist",
"allowJs": true,
"esModuleInterop": true,
"moduleResolution": "node",
"moduleResolution": "Node",
"baseUrl": ".",
"jsx": "preserve",
"types": ["vite/client", "node"]
Expand Down
6 changes: 3 additions & 3 deletions playground/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"include": ["."],
"exclude": ["**/dist/**"],
"compilerOptions": {
"target": "es2019",
"module": "esnext",
"target": "ES2020",
"module": "ESNext",
"outDir": "dist",
"baseUrl": ".",
"allowJs": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"moduleResolution": "node",
"moduleResolution": "Node",
"skipLibCheck": true,
"noUnusedLocals": true,
"jsx": "preserve",
Expand Down
6 changes: 3 additions & 3 deletions scripts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"$schema": "https://json.schemastore.org/tsconfig",
"include": ["."],
"compilerOptions": {
"module": "commonjs",
"target": "es2019",
"moduleResolution": "node",
"module": "CommonJS",
"target": "ES2020",
"moduleResolution": "Node",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
Expand Down