Skip to content

Commit f78cf75

Browse files
committed
fix(bug): don't default chunkFileName to a filename typeof function
1 parent 73d418a commit f78cf75

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/WebpackOptionsDefaulter.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,15 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
8585
this.set("output.filename", "[name].js");
8686
this.set("output.chunkFilename", "make", options => {
8787
const filename = options.output.filename;
88-
if (typeof filename === "function") return filename;
89-
const hasName = filename.includes("[name]");
90-
const hasId = filename.includes("[id]");
91-
const hasChunkHash = filename.includes("[chunkhash]");
92-
// Anything changing depending on chunk is fine
93-
if (hasChunkHash || hasName || hasId) return filename;
94-
// Elsewise prefix "[id]." in front of the basename to make it changing
95-
return filename.replace(/(^|\/)([^/]*(?:\?|$))/, "$1[id].$2");
88+
if (typeof filename !== "function") {
89+
const hasName = filename.includes("[name]");
90+
const hasId = filename.includes("[id]");
91+
const hasChunkHash = filename.includes("[chunkhash]");
92+
// Anything changing depending on chunk is fine
93+
if (hasChunkHash || hasName || hasId) return filename;
94+
// Elsewise prefix "[id]." in front of the basename to make it changing
95+
return filename.replace(/(^|\/)([^/]*(?:\?|$))/, "$1[id].$2");
96+
}
9697
});
9798
this.set("output.webassemblyModuleFilename", "[modulehash].module.wasm");
9899
this.set("output.library", "");

0 commit comments

Comments
 (0)