Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbb4f8eb

Browse files
fix: regression for custom configurations (#3834)
1 parent14b9c18 commitbb4f8eb

File tree

11 files changed

+1059
-17
lines changed

11 files changed

+1059
-17
lines changed

‎package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
"webpack":"5.x.x"
5454
},
5555
"devDependencies": {
56+
"@babel/core":"^7.22.1",
57+
"@babel/preset-env":"^7.22.4",
58+
"@babel/register":"^7.15.8",
5659
"@commitlint/cli":"^17.1.2",
5760
"@commitlint/config-conventional":"^17.1.0",
5861
"@types/jest":"^29.4.0",

‎packages/webpack-cli/src/webpack-cli.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,8 +1802,7 @@ class WebpackCLI implements IWebpackCLI {
18021802
constinterpret=require("interpret");
18031803
constloadConfigByPath=async(configPath:string,argv:Argv={})=>{
18041804
constext=path.extname(configPath).toLowerCase();
1805-
letinterpreted=interpret.jsVariants[ext];
1806-
1805+
letinterpreted=Object.keys(interpret.jsVariants).find((variant)=>variant===ext);
18071806
// Fallback `.cts` to `.ts`
18081807
// TODO implement good `.mts` support after https://github.com/gulpjs/rechoir/issues/43
18091808
// For ESM and `.mts` you need to use: 'NODE_OPTIONS="--loader ts-node/esm" webpack-cli --config ./webpack.config.mts'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// eslint-disable-next-line node/no-unpublished-require
2+
const{ run}=require("../../../utils/test-utils");
3+
4+
describe("webpack cli",()=>{
5+
it("should support mjs config format",async()=>{
6+
const{ exitCode, stderr, stdout}=awaitrun(__dirname,["-c","webpack.config.babel.js"]);
7+
8+
console.log(stderr);
9+
10+
expect(exitCode).toBe(0);
11+
expect(stderr).toBeFalsy();
12+
expect(stdout).toBeTruthy();
13+
});
14+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("You know who");
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"engines": {
3+
"node":">=14.15.0"
4+
}
5+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
constpath=require("path");
2+
3+
module.exports={
4+
mode:"development",
5+
entry:"./main.js",
6+
output:{
7+
path:path.resolve(__dirname,"dist"),
8+
filename:"foo.bundle.js",
9+
},
10+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// eslint-disable-next-line node/no-unpublished-require
2+
const{ run}=require("../../../utils/test-utils");
3+
4+
describe("webpack cli",()=>{
5+
it("should support mjs config format",async()=>{
6+
const{ exitCode, stderr, stdout}=awaitrun(__dirname,["-c","webpack.config.babel.js"]);
7+
8+
expect(exitCode).toBe(0);
9+
expect(stderr).toBeFalsy();
10+
expect(stdout).toBeTruthy();
11+
});
12+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("You know who");
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"type":"module",
3+
"engines": {
4+
"node":">=14.15.0"
5+
}
6+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable */
2+
import{fileURLToPath}from"url";
3+
importpathfrom"path";
4+
5+
exportdefault{
6+
mode:"development",
7+
entry:"./main.js",
8+
output:{
9+
path:path.resolve(path.dirname(fileURLToPath(import.meta.url)),"dist"),
10+
filename:"foo.bundle.js",
11+
},
12+
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp