diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index f22c2a1747c..07b5c3bc21c 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -66,7 +66,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - node-version: [14.x, 16.x, 18.x, 19.x] + node-version: [14.x, 16.x, 18.x, 20.x] shard: ["1/4", "2/4", "3/4", "4/4"] webpack-version: [latest] dev-server-version: [latest] diff --git a/package.json b/package.json index 35598849252..0fc93b7663b 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "style-loader": "^3.3.1", "ts-jest": "^29.0.1", "ts-loader": "^9.3.1", - "ts-node": "^10.8.0", + "ts-node": "^10.9.1", "typescript": "^5.0.4", "webpack": "^5.72.0", "webpack-bundle-analyzer": "^4.5.0", diff --git a/test/build/config-format/typescript-esnext/package.json b/test/build/config-format/typescript-esnext/package.json index 3dbc1ca591c..aa65b114f15 100644 --- a/test/build/config-format/typescript-esnext/package.json +++ b/test/build/config-format/typescript-esnext/package.json @@ -1,3 +1,6 @@ { - "type": "module" + "type": "module", + "engines": { + "node": ">=14.15.0" + } } diff --git a/test/build/config-format/typescript-esnext/typescript.test.js b/test/build/config-format/typescript-esnext/typescript.test.js index 675f44a4442..e1c0f0dd847 100644 --- a/test/build/config-format/typescript-esnext/typescript.test.js +++ b/test/build/config-format/typescript-esnext/typescript.test.js @@ -13,9 +13,18 @@ describe("webpack cli", () => { return; } + const env = { ...process.env }; + + if (majorNodeVersion >= 20) { + // Node.js 20+ change logic, so we need to force esm config loading for test purposes + env.WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG = true; + } + const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.ts"], { - nodeOptions: ["--loader=ts-node/esm"], + nodeOptions: ["--experimental-loader=ts-node/esm"], + env, }); + expect(stderr).not.toBeFalsy(); // Deprecation warning logs on stderr expect(stdout).toBeTruthy(); expect(exitCode).toBe(0); diff --git a/yarn.lock b/yarn.lock index df08a975004..803b0ecd7da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9700,7 +9700,7 @@ ts-loader@^9.3.1: micromatch "^4.0.0" semver "^7.3.4" -ts-node@^10.8.0, ts-node@^10.8.1: +ts-node@^10.8.1, ts-node@^10.9.1: version "10.9.1" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==