-
-
Notifications
You must be signed in to change notification settings - Fork 621
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dcf4581
commit c239734
Showing
11 changed files
with
58 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
9 changes: 9 additions & 0 deletions
9
test/build/config-format/typescript-commonjs-using-nodejs/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "esnext", | ||
"allowImportingTsExtensions": true, | ||
"rewriteRelativeImportExtensions": true, | ||
"verbatimModuleSyntax": true, | ||
"module": "commonjs" | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
test/build/config-format/typescript-commonjs-using-nodejs/typescript.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const { run } = require("../../../utils/test-utils"); | ||
const { existsSync } = require("fs"); | ||
const { resolve } = require("path"); | ||
|
||
describe("webpack cli", () => { | ||
it("should support typescript file", async () => { | ||
// This test is for https://nodejs.org/api/typescript.html#modules-typescript | ||
// By default this feature enabled only since v23.6.0 | ||
// For old Node.js version it uses `typescript` | ||
// For v23.6.0+ Node.js version it uses built-in feature | ||
const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.cts"], { | ||
env: { NODE_NO_WARNINGS: 1 }, | ||
}); | ||
|
||
expect(stderr).toBeFalsy(); | ||
expect(stdout).toBeTruthy(); | ||
expect(exitCode).toBe(0); | ||
expect(existsSync(resolve(__dirname, "dist/foo.bundle.js"))).toBeTruthy(); | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
test/build/config-format/typescript-commonjs-using-nodejs/webpack.config.cts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* eslint-disable node/no-unsupported-features/es-syntax */ | ||
/** eslint-disable **/ | ||
const path = require("path"); | ||
|
||
// cspell:ignore elopment | ||
const mode: string = "dev" + "elopment"; | ||
const config = { | ||
mode, | ||
entry: "./main.ts", | ||
output: { | ||
path: path.resolve(__dirname, "dist"), | ||
filename: "foo.bundle.js", | ||
}, | ||
}; | ||
|
||
module.exports = config; |
1 change: 1 addition & 0 deletions
1
test/build/config-format/typescript-commonjs-using-typescript/main.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("Main typescript file"); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters