Skip to content

Commit 2c1a45c

Browse files
authored
feat!: bump minimum node version to 18 (vitejs#14030)
1 parent 63a4451 commit 2c1a45c

19 files changed

+27
-30
lines changed

.eslintrc.cjs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @ts-check
22
const { builtinModules } = require('node:module')
33
const { defineConfig } = require('eslint-define-config')
4+
const pkg = require('./package.json')
45

56
module.exports = defineConfig({
67
root: true,
@@ -16,7 +17,7 @@ module.exports = defineConfig({
1617
parser: '@typescript-eslint/parser',
1718
parserOptions: {
1819
sourceType: 'module',
19-
ecmaVersion: 2021,
20+
ecmaVersion: 2022,
2021
},
2122
rules: {
2223
eqeqeq: ['warn', 'always', { null: 'never' }],
@@ -173,13 +174,13 @@ module.exports = defineConfig({
173174
'n/no-unsupported-features/es-builtins': [
174175
'error',
175176
{
176-
version: '^14.18.0 || >=16.0.0',
177+
version: pkg.engines.node,
177178
},
178179
],
179180
'n/no-unsupported-features/node-builtins': [
180181
'error',
181182
{
182-
version: '^14.18.0 || >=16.0.0',
183+
version: pkg.engines.node,
183184
},
184185
],
185186
'@typescript-eslint/explicit-module-boundary-types': 'off',

.github/workflows/ci.yml

+2-8
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
strategy:
4040
matrix:
4141
os: [ubuntu-latest]
42-
node_version: [14, 16, 18, 20]
42+
node_version: [18, 20]
4343
include:
4444
# Active LTS + other OS
4545
- os: macos-latest
@@ -67,14 +67,8 @@ jobs:
6767
packages/create-vite/template**
6868
**.md
6969
70-
- name: Install pnpm (node 14, pnpm 7)
71-
if: steps.changed-files.outputs.only_changed != 'true' && matrix.node_version == 14
72-
uses: pnpm/[email protected]
73-
with:
74-
version: 7
75-
7670
- name: Install pnpm
77-
if: steps.changed-files.outputs.only_changed != 'true' && matrix.node_version != 14
71+
if: steps.changed-files.outputs.only_changed != 'true'
7872
uses: pnpm/[email protected]
7973

8074
- name: Set node version to ${{ matrix.node_version }}

.github/workflows/publish.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ jobs:
2323
- name: Install pnpm
2424
uses: pnpm/[email protected]
2525

26-
- name: Set node version to 16.x
26+
- name: Set node version to 18
2727
uses: actions/setup-node@v3
2828
with:
29-
node-version: 16.x
29+
node-version: 18
3030
registry-url: https://registry.npmjs.org/
3131
cache: "pnpm"
3232

docs/guide/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The supported template presets are:
4242
## Scaffolding Your First Vite Project
4343

4444
::: tip Compatibility Note
45-
Vite requires [Node.js](https://nodejs.org/en/) version 14.18+, 16+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it.
45+
Vite requires [Node.js](https://nodejs.org/en/) version 18+. 20+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it.
4646
:::
4747

4848
::: code-group

netlify.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build.environment]
2-
NODE_VERSION = "16"
2+
NODE_VERSION = "18"
33
# don't need playwright for docs build
44
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1"
55
[build]

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"private": true,
44
"type": "module",
55
"engines": {
6-
"node": "^14.18.0 || >=16.0.0"
6+
"node": "^18.0.0 || >=20.0.0"
77
},
88
"homepage": "https://vitejs.dev/",
99
"repository": {

packages/create-vite/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Scaffolding Your First Vite Project
44

55
> **Compatibility Note:**
6-
> Vite requires [Node.js](https://nodejs.org/en/) version 14.18+, 16+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it.
6+
> Vite requires [Node.js](https://nodejs.org/en/) version 18+, 20+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it.
77
88
With NPM:
99

packages/create-vite/build.config.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ export default defineBuildConfig({
1111
rollup: {
1212
inlineDependencies: true,
1313
esbuild: {
14+
target: 'node18',
1415
minify: true,
1516
},
1617
},
1718
alias: {
18-
// we can always use non-transpiled code since we support 14.18.0+
19+
// we can always use non-transpiled code since we support node 18+
1920
prompts: 'prompts/lib/index.js',
2021
},
2122
hooks: {

packages/create-vite/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"prepublishOnly": "npm run build"
2121
},
2222
"engines": {
23-
"node": "^14.18.0 || >=16.0.0"
23+
"node": "^18.0.0 || >=20.0.0"
2424
},
2525
"repository": {
2626
"type": "git",

packages/create-vite/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"include": ["build.config.ts", "src", "__tests__"],
33
"compilerOptions": {
44
"outDir": "dist",
5-
"target": "ES2020",
5+
"target": "ES2022",
66
"module": "ES2020",
77
"moduleResolution": "bundler",
88
"strict": true,

packages/plugin-legacy/build.config.ts

+3
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ export default defineBuildConfig({
77
rollup: {
88
emitCJS: true,
99
inlineDependencies: true,
10+
esbuild: {
11+
target: 'node18',
12+
},
1013
},
1114
})

packages/plugin-legacy/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"prepublishOnly": "npm run build"
3030
},
3131
"engines": {
32-
"node": "^14.18.0 || >=16.0.0"
32+
"node": "^18.0.0 || >=20.0.0"
3333
},
3434
"repository": {
3535
"type": "git",

packages/vite/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"types"
3939
],
4040
"engines": {
41-
"node": "^14.18.0 || >=16.0.0"
41+
"node": "^18.0.0 || >=20.0.0"
4242
},
4343
"repository": {
4444
"type": "git",

packages/vite/src/node/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ async function bundleConfigFile(
10171017
entryPoints: [fileName],
10181018
outfile: 'out.js',
10191019
write: false,
1020-
target: ['node14.18', 'node16'],
1020+
target: ['node18'],
10211021
platform: 'node',
10221022
bundle: true,
10231023
format: isESM ? 'esm' : 'cjs',

packages/vite/tsconfig.base.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"target": "ES2020",
3+
"target": "ES2022",
44
"module": "ESNext",
55
"moduleResolution": "node",
66
"strict": true,

playground/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"exclude": ["**/dist/**"],
44
"compilerOptions": {
55
"checkJs": true,
6-
"target": "ES2020",
6+
"target": "ES2022",
77
"module": "ESNext",
88
"outDir": "dist",
99
"baseUrl": ".",

scripts/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://json.schemastore.org/tsconfig",
33
"include": ["."],
44
"compilerOptions": {
5-
"module": "ES2020",
5+
"module": "ES2022",
66
"target": "ES2020",
77
"moduleResolution": "Node",
88
"strict": true,

vitest.config.e2e.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ export default defineConfig({
2626
},
2727
},
2828
esbuild: {
29-
target: 'node14',
29+
target: 'node18',
3030
},
3131
})

vitest.config.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ export default defineConfig({
1010
'./playground-temp/**/*.*',
1111
],
1212
testTimeout: 20000,
13-
// node14 segfaults often with threads
14-
threads: !process.versions.node.startsWith('14'),
1513
},
1614
esbuild: {
17-
target: 'node14',
15+
target: 'node18',
1816
},
1917
})

0 commit comments

Comments
 (0)