Skip to content

Commit

Permalink
feat!: bump minimum node version to 18 (#14030)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy authored Aug 15, 2023
1 parent 63a4451 commit 2c1a45c
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 30 deletions.
7 changes: 4 additions & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @ts-check
const { builtinModules } = require('node:module')
const { defineConfig } = require('eslint-define-config')
const pkg = require('./package.json')

module.exports = defineConfig({
root: true,
Expand All @@ -16,7 +17,7 @@ module.exports = defineConfig({
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2021,
ecmaVersion: 2022,
},
rules: {
eqeqeq: ['warn', 'always', { null: 'never' }],
Expand Down Expand Up @@ -173,13 +174,13 @@ module.exports = defineConfig({
'n/no-unsupported-features/es-builtins': [
'error',
{
version: '^14.18.0 || >=16.0.0',
version: pkg.engines.node,
},
],
'n/no-unsupported-features/node-builtins': [
'error',
{
version: '^14.18.0 || >=16.0.0',
version: pkg.engines.node,
},
],
'@typescript-eslint/explicit-module-boundary-types': 'off',
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node_version: [14, 16, 18, 20]
node_version: [18, 20]
include:
# Active LTS + other OS
- os: macos-latest
Expand Down Expand Up @@ -67,14 +67,8 @@ jobs:
packages/create-vite/template**
**.md
- name: Install pnpm (node 14, pnpm 7)
if: steps.changed-files.outputs.only_changed != 'true' && matrix.node_version == 14
uses: pnpm/action-setup@v2.4.0
with:
version: 7

- name: Install pnpm
if: steps.changed-files.outputs.only_changed != 'true' && matrix.node_version != 14
if: steps.changed-files.outputs.only_changed != 'true'
uses: pnpm/action-setup@v2.4.0

- name: Set node version to ${{ matrix.node_version }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2.4.0

- name: Set node version to 16.x
- name: Set node version to 18
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18
registry-url: https://registry.npmjs.org/
cache: "pnpm"

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The supported template presets are:
## Scaffolding Your First Vite Project

::: tip Compatibility Note
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.
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.
:::

::: code-group
Expand Down
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build.environment]
NODE_VERSION = "16"
NODE_VERSION = "18"
# don't need playwright for docs build
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1"
[build]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"type": "module",
"engines": {
"node": "^14.18.0 || >=16.0.0"
"node": "^18.0.0 || >=20.0.0"
},
"homepage": "https://vitejs.dev/",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Scaffolding Your First Vite Project

> **Compatibility Note:**
> 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.
> 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.
With NPM:

Expand Down
3 changes: 2 additions & 1 deletion packages/create-vite/build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ export default defineBuildConfig({
rollup: {
inlineDependencies: true,
esbuild: {
target: 'node18',
minify: true,
},
},
alias: {
// we can always use non-transpiled code since we support 14.18.0+
// we can always use non-transpiled code since we support node 18+
prompts: 'prompts/lib/index.js',
},
hooks: {
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"prepublishOnly": "npm run build"
},
"engines": {
"node": "^14.18.0 || >=16.0.0"
"node": "^18.0.0 || >=20.0.0"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"include": ["build.config.ts", "src", "__tests__"],
"compilerOptions": {
"outDir": "dist",
"target": "ES2020",
"target": "ES2022",
"module": "ES2020",
"moduleResolution": "bundler",
"strict": true,
Expand Down
3 changes: 3 additions & 0 deletions packages/plugin-legacy/build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ export default defineBuildConfig({
rollup: {
emitCJS: true,
inlineDependencies: true,
esbuild: {
target: 'node18',
},
},
})
2 changes: 1 addition & 1 deletion packages/plugin-legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"prepublishOnly": "npm run build"
},
"engines": {
"node": "^14.18.0 || >=16.0.0"
"node": "^18.0.0 || >=20.0.0"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"types"
],
"engines": {
"node": "^14.18.0 || >=16.0.0"
"node": "^18.0.0 || >=20.0.0"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ async function bundleConfigFile(
entryPoints: [fileName],
outfile: 'out.js',
write: false,
target: ['node14.18', 'node16'],
target: ['node18'],
platform: 'node',
bundle: true,
format: isESM ? 'esm' : 'cjs',
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": "ES2020",
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "node",
"strict": true,
Expand Down
2 changes: 1 addition & 1 deletion playground/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"exclude": ["**/dist/**"],
"compilerOptions": {
"checkJs": true,
"target": "ES2020",
"target": "ES2022",
"module": "ESNext",
"outDir": "dist",
"baseUrl": ".",
Expand Down
2 changes: 1 addition & 1 deletion scripts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"include": ["."],
"compilerOptions": {
"module": "ES2020",
"module": "ES2022",
"target": "ES2020",
"moduleResolution": "Node",
"strict": true,
Expand Down
2 changes: 1 addition & 1 deletion vitest.config.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ export default defineConfig({
},
},
esbuild: {
target: 'node14',
target: 'node18',
},
})
4 changes: 1 addition & 3 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ export default defineConfig({
'./playground-temp/**/*.*',
],
testTimeout: 20000,
// node14 segfaults often with threads
threads: !process.versions.node.startsWith('14'),
},
esbuild: {
target: 'node14',
target: 'node18',
},
})

0 comments on commit 2c1a45c

Please sign in to comment.