Skip to content

Commit 9a8a555

Browse files
ci: fix
1 parent dcf4581 commit 9a8a555

File tree

9 files changed

+50
-2
lines changed

9 files changed

+50
-2
lines changed

.github/workflows/nodejs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
strategy:
5959
matrix:
6060
os: [ubuntu-latest, windows-latest, macos-latest]
61-
node-version: [18.x, 20.x, 22.x, 23.5.0]
61+
node-version: [18.x, 20.x, 22.x, 23.x]
6262
shard: ["1/4", "2/4", "3/4", "4/4"]
6363
webpack-version: [latest]
6464
dev-server-version: [latest]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"compilerOptions": {
3+
"target": "esnext",
4+
"allowImportingTsExtensions": true,
5+
"rewriteRelativeImportExtensions": true,
6+
"verbatimModuleSyntax": true,
7+
"module": "commonjs"
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const { run } = require("../../../utils/test-utils");
2+
const { existsSync } = require("fs");
3+
const { resolve } = require("path");
4+
5+
describe("webpack cli", () => {
6+
it("should support typescript file", async () => {
7+
// This test is for https://nodejs.org/api/typescript.html#modules-typescript
8+
// By default this feature enabled only since v23.6.0
9+
// For old Node.js version it uses `typescript`
10+
// For v23.6.0+ Node.js version it uses built-in feature
11+
const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.cts"], {
12+
env: { NODE_NO_WARNINGS: 1 },
13+
});
14+
15+
expect(stderr).toBeFalsy();
16+
expect(stdout).toBeTruthy();
17+
expect(exitCode).toBe(0);
18+
expect(existsSync(resolve(__dirname, "dist/foo.bundle.js"))).toBeTruthy();
19+
});
20+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* eslint-disable node/no-unsupported-features/es-syntax */
2+
/** eslint-disable **/
3+
const path = require("path");
4+
5+
// cspell:ignore elopment
6+
const mode: string = "dev" + "elopment";
7+
const config = {
8+
mode,
9+
entry: "./main.ts",
10+
output: {
11+
path: path.resolve(__dirname, "dist"),
12+
filename: "foo.bundle.js",
13+
},
14+
};
15+
16+
module.exports = config;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("Main typescript file");

test/build/config-format/typescript-commonjs/typescript.test.js renamed to test/build/config-format/typescript-commonjs-using-typescript/typescript.test.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ const { resolve } = require("path");
44

55
describe("webpack cli", () => {
66
it("should support typescript file", async () => {
7-
const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.cts"]);
7+
const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.cts"], {
8+
nodeOptions: ["--no-experimental-strip-types"],
9+
});
810

911
expect(stderr).toBeFalsy();
1012
expect(stdout).toBeTruthy();

0 commit comments

Comments
 (0)