Skip to content

Commit 8f65ae9

Browse files
authored
fix: transpile esnext to node18 to support newest JS and TS features (#4409)
1 parent 057b4f3 commit 8f65ae9

File tree

8 files changed

+224
-492
lines changed

8 files changed

+224
-492
lines changed

.github/actions/setup-and-cache/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111

1212
steps:
1313
- name: Install pnpm
14-
uses: pnpm/action-setup@v2
14+
uses: pnpm/action-setup@v4
1515

1616
- name: Set node version to ${{ inputs.node-version }}
1717
uses: actions/setup-node@v4

.github/workflows/bench.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v4
1515

1616
- name: Install pnpm
17-
uses: pnpm/action-setup@v2
17+
uses: pnpm/action-setup@v4
1818

1919
- name: Install node
2020
uses: actions/setup-node@v4

.github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fetch-depth: 0
2121

2222
- name: Install pnpm
23-
uses: pnpm/action-setup@v3
23+
uses: pnpm/action-setup@v4
2424

2525
- name: Set node version to 20
2626
uses: actions/setup-node@v4

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"simple-git-hooks": "^2.11.1",
6464
"tsx": "^4.16.0",
6565
"typescript": "^5.5.2",
66-
"vite": "^5.2.6",
66+
"vite": "^5.3.3",
6767
"vitest": "workspace:*",
6868
"zx": "^8.1.3"
6969
},

packages/vitest/src/node/plugins/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ export async function VitestPlugin(
8181
viteConfig.esbuild === false
8282
? false
8383
: {
84+
// Lowest target Vitest supports is Node18
85+
target: viteConfig.esbuild?.target || 'node18',
8486
sourcemap: 'external',
85-
8687
// Enables using ignore hint for coverage providers with @preserve keyword
8788
legalComments: 'inline',
8889
},

packages/vitest/src/node/plugins/workspace.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,15 @@ export function WorkspaceVitestPlugin(
7070
alias: testConfig.alias,
7171
conditions: ['node'],
7272
},
73-
esbuild: {
74-
sourcemap: 'external',
75-
76-
// Enables using ignore hint for coverage providers with @preserve keyword
77-
legalComments: 'inline',
78-
},
73+
esbuild: viteConfig.esbuild === false
74+
? false
75+
: {
76+
// Lowest target Vitest supports is Node18
77+
target: viteConfig.esbuild?.target || 'node18',
78+
sourcemap: 'external',
79+
// Enables using ignore hint for coverage providers with @preserve keyword
80+
legalComments: 'inline',
81+
},
7982
server: {
8083
// disable watch mode in workspaces,
8184
// because it is handled by the top-level watcher

0 commit comments

Comments
 (0)