Skip to content

Commit 45fac7d

Browse files
authored
Merge pull request #13143 from webpack/bugfix/falsy-entry-options
handle falsy entry options correctly
2 parents 7a7d3be + 2df8267 commit 45fac7d

10 files changed

+28
-10
lines changed

lib/Compilation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4035,7 +4035,7 @@ This prevents using hashes of each other and should be avoided.`);
40354035

40364036
const entrypoint = new Entrypoint({
40374037
runtime,
4038-
chunkLoading: "none",
4038+
chunkLoading: false,
40394039
...options.entryOptions
40404040
});
40414041
chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint);

lib/RuntimePlugin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ class RuntimePlugin {
179179
const { publicPath: globalPublicPath, scriptType } = outputOptions;
180180
const entryOptions = chunk.getEntryOptions();
181181
const publicPath =
182-
(entryOptions && entryOptions.publicPath) || globalPublicPath;
182+
entryOptions && entryOptions.publicPath !== undefined
183+
? entryOptions.publicPath
184+
: globalPublicPath;
183185

184186
if (publicPath === "auto") {
185187
const module = new AutoPublicPathRuntimeModule();

lib/node/CommonJsChunkLoadingPlugin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ class CommonJsChunkLoadingPlugin {
3939
const isEnabledForChunk = chunk => {
4040
const options = chunk.getEntryOptions();
4141
const chunkLoading =
42-
(options && options.chunkLoading) || globalChunkLoading;
42+
options && options.chunkLoading !== undefined
43+
? options.chunkLoading
44+
: globalChunkLoading;
4345
return chunkLoading === chunkLoadingValue;
4446
};
4547
const onceForChunkSet = new WeakSet();

lib/node/ReadFileCompileAsyncWasmPlugin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ class ReadFileCompileAsyncWasmPlugin {
2525
const isEnabledForChunk = chunk => {
2626
const options = chunk.getEntryOptions();
2727
const wasmLoading =
28-
(options && options.wasmLoading) || globalWasmLoading;
28+
options && options.wasmLoading !== undefined
29+
? options.wasmLoading
30+
: globalWasmLoading;
2931
return wasmLoading === "async-node";
3032
};
3133
const generateLoadBinaryCode = path =>

lib/node/ReadFileCompileWasmPlugin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ class ReadFileCompileWasmPlugin {
3131
const isEnabledForChunk = chunk => {
3232
const options = chunk.getEntryOptions();
3333
const wasmLoading =
34-
(options && options.wasmLoading) || globalWasmLoading;
34+
options && options.wasmLoading !== undefined
35+
? options.wasmLoading
36+
: globalWasmLoading;
3537
return wasmLoading === "async-node";
3638
};
3739
const generateLoadBinaryCode = path =>

lib/runtime/StartupChunkDependenciesPlugin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ class StartupChunkDependenciesPlugin {
3232
const isEnabledForChunk = chunk => {
3333
const options = chunk.getEntryOptions();
3434
const chunkLoading =
35-
(options && options.chunkLoading) || globalChunkLoading;
35+
options && options.chunkLoading !== undefined
36+
? options.chunkLoading
37+
: globalChunkLoading;
3638
return chunkLoading === this.chunkLoading;
3739
};
3840
compilation.hooks.additionalTreeRuntimeRequirements.tap(

lib/web/FetchCompileAsyncWasmPlugin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ class FetchCompileAsyncWasmPlugin {
2424
const isEnabledForChunk = chunk => {
2525
const options = chunk.getEntryOptions();
2626
const wasmLoading =
27-
(options && options.wasmLoading) || globalWasmLoading;
27+
options && options.wasmLoading !== undefined
28+
? options.wasmLoading
29+
: globalWasmLoading;
2830
return wasmLoading === "fetch";
2931
};
3032
const generateLoadBinaryCode = path =>

lib/web/FetchCompileWasmPlugin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ class FetchCompileWasmPlugin {
3030
const isEnabledForChunk = chunk => {
3131
const options = chunk.getEntryOptions();
3232
const wasmLoading =
33-
(options && options.wasmLoading) || globalWasmLoading;
33+
options && options.wasmLoading !== undefined
34+
? options.wasmLoading
35+
: globalWasmLoading;
3436
return wasmLoading === "fetch";
3537
};
3638
const generateLoadBinaryCode = path =>

lib/web/JsonpChunkLoadingPlugin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ class JsonpChunkLoadingPlugin {
2424
const isEnabledForChunk = chunk => {
2525
const options = chunk.getEntryOptions();
2626
const chunkLoading =
27-
(options && options.chunkLoading) || globalChunkLoading;
27+
options && options.chunkLoading !== undefined
28+
? options.chunkLoading
29+
: globalChunkLoading;
2830
return chunkLoading === "jsonp";
2931
};
3032
const onceForChunkSet = new WeakSet();

lib/webworker/ImportScriptsChunkLoadingPlugin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ class ImportScriptsChunkLoadingPlugin {
2929
const isEnabledForChunk = chunk => {
3030
const options = chunk.getEntryOptions();
3131
const chunkLoading =
32-
(options && options.chunkLoading) || globalChunkLoading;
32+
options && options.chunkLoading !== undefined
33+
? options.chunkLoading
34+
: globalChunkLoading;
3335
return chunkLoading === "import-scripts";
3436
};
3537
const onceForChunkSet = new WeakSet();

0 commit comments

Comments
 (0)