Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"compilerOptions": {
"module": "esnext",
"allowSyntheticDefaultImports": true
"target": "esnext",
"allowImportingTsExtensions": true,
"rewriteRelativeImportExtensions": true,
"module": "esnext"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// eslint-disable-next-line n/no-unpublished-require
const { run } = require("../../../utils/test-utils");
const { existsSync } = require("fs");
const { resolve } = require("path");

describe("webpack cli", () => {
it("should support typescript esnext file", async () => {
const [major] = process.versions.node.split(".").map(Number);
const { exitCode, stderr, stdout } = await run(
__dirname,
["-c", "./webpack.config.ts", "--disable-interpret"],
{
env: {
NODE_NO_WARNINGS: 1,
// Due nyc logic
WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG: true,
},
// Fallback to `ts-node/esm` for old Node.js versions
nodeOptions: major >= 24 ? [] : ["--experimental-loader=ts-node/esm"],
},
);

expect(stderr).toBeFalsy(); // Deprecation warning logs on stderr
expect(stdout).toBeTruthy();
expect(exitCode).toBe(0);
expect(existsSync(resolve(__dirname, "dist/foo.bundle.js"))).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable node/no-unsupported-features/es-syntax */
import * as path from "path";

// cspell:ignore elopment
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"compilerOptions": {
"module": "esnext",
"allowSyntheticDefaultImports": true
"target": "esnext",
"allowImportingTsExtensions": true,
"rewriteRelativeImportExtensions": true,
"module": "esnext"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@ const { resolve } = require("path");

describe("webpack cli", () => {
it("should support typescript esnext file", async () => {
const [major, minor] = process.versions.node.split(".").map(Number);
const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.mts"], {
env: { NODE_NO_WARNINGS: 1 },
// Fallback to `ts-node/esm` for old Node.js versions
nodeOptions: major >= 22 && minor >= 6 ? [] : ["--experimental-loader=ts-node/esm"],
});
const [major] = process.versions.node.split(".").map(Number);
const { exitCode, stderr, stdout } = await run(
__dirname,
["-c", "./webpack.config.ts", "--disable-interpret"],
{
env: {
NODE_NO_WARNINGS: 1,
// Due nyc logic
WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG: true,
},
// Fallback to `ts-node/esm` for old Node.js versions
nodeOptions: major >= 24 ? [] : ["--experimental-loader=ts-node/esm"],
},
);

expect(stderr).toBeFalsy(); // Deprecation warning logs on stderr
expect(stdout).toBeTruthy();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable node/no-unsupported-features/es-syntax */
const path = require("path");
import * as path from "path";

// cspell:ignore elopment
const mode: string = "dev" + "elopment";
Expand All @@ -12,4 +11,4 @@ const config = {
},
};

module.exports = config;
export default config;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ describe("webpack cli", () => {
it("should support typescript esnext file", async () => {
const [major, minor] = process.versions.node.split(".").map(Number);
const { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.ts"], {
env: { NODE_NO_WARNINGS: 1 },
env: {
NODE_NO_WARNINGS: 1,
// Due nyc logic
WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG: true,
},
nodeOptions:
major >= 22 && minor >= 6
? ["--no-experimental-strip-types", "--experimental-loader=ts-node/esm"]
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"compilerOptions": {
"module": "esnext",
"allowSyntheticDefaultImports": true
"target": "esnext",
"allowImportingTsExtensions": true,
"rewriteRelativeImportExtensions": true,
"module": "esnext"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// eslint-disable-next-line n/no-unpublished-require
const { run } = require("../../../utils/test-utils");
const { existsSync } = require("fs");
const { resolve } = require("path");

describe("webpack cli", () => {
it("should support typescript esnext file", async () => {
const [major] = process.versions.node.split(".").map(Number);
const { exitCode, stderr, stdout } = await run(
__dirname,
["-c", "./webpack.config.ts", "--disable-interpret"],
{
env: {
NODE_NO_WARNINGS: 1,
// Due nyc logic
WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG: true,
},
// Fallback to `ts-node/esm` for old Node.js versions
nodeOptions: major >= 24 ? [] : ["--experimental-loader=ts-node/esm"],
},
);

expect(stderr).toBeFalsy(); // Deprecation warning logs on stderr
expect(stdout).toBeTruthy();
expect(exitCode).toBe(0);
expect(existsSync(resolve(__dirname, "dist/foo.bundle.js"))).toBeTruthy();
});
});