mirror of https://github.com/webpack/webpack.git
use global chunkLoading option
This commit is contained in:
parent
26f3a1d21c
commit
bbbe300e3a
|
|
@ -97,6 +97,15 @@ class RuntimePlugin {
|
|||
*/
|
||||
apply(compiler) {
|
||||
compiler.hooks.compilation.tap("RuntimePlugin", compilation => {
|
||||
const globalChunkLoading = compilation.outputOptions.chunkLoading;
|
||||
const isChunkLoadingDisabledForChunk = chunk => {
|
||||
const options = chunk.getEntryOptions();
|
||||
const chunkLoading =
|
||||
options && options.chunkLoading !== undefined
|
||||
? options.chunkLoading
|
||||
: globalChunkLoading;
|
||||
return chunkLoading === false;
|
||||
};
|
||||
compilation.dependencyTemplates.set(
|
||||
RuntimeRequirementsDependency,
|
||||
new RuntimeRequirementsDependency.Template()
|
||||
|
|
@ -417,8 +426,7 @@ class RuntimePlugin {
|
|||
compilation.hooks.runtimeRequirementInTree
|
||||
.for(RuntimeGlobals.baseURI)
|
||||
.tap("RuntimePlugin", chunk => {
|
||||
const { chunkLoading } = chunk.getEntryOptions();
|
||||
if (chunkLoading === false) {
|
||||
if (isChunkLoadingDisabledForChunk(chunk)) {
|
||||
compilation.addRuntimeModule(chunk, new BaseUriRuntimeModule());
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue