From 37f3dc2f3197f8469762ea107b22df64dda12586 Mon Sep 17 00:00:00 2001 From: Chuck Dumont Date: Thu, 28 Oct 2021 15:07:41 -0400 Subject: [PATCH] Don't include our runtime modules in build time chunks --- lib/DojoAMDPlugin.js | 16 +++++++++------- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/DojoAMDPlugin.js b/lib/DojoAMDPlugin.js index 034f1a3..13c089f 100644 --- a/lib/DojoAMDPlugin.js +++ b/lib/DojoAMDPlugin.js @@ -63,10 +63,12 @@ module.exports = class DojoAMDPlugin { compilationPlugins(compilation, params) { if (!this.options.isSkipCompilation(compilation)) { compilation.hooks.additionalTreeRuntimeRequirements - .tap("dojo-webpack-plugin", (chunk, set) => { - compilation.addRuntimeModule(chunk, this.newRuntimeModule(chunk, set, this.compiler)); - set.add("__webpack_require__.dj"); - return true; + .tap(DojoAMDPlugin.pluginName, (chunk, set) => { + if (chunk.runtime !== 'build time') { + compilation.addRuntimeModule(chunk, this.newRuntimeModule(chunk, set, this.compiler)); + set.add("__webpack_require__.dj"); + return true; + } }); const DojoAMDRequireItemDependency = require("./DojoAMDRequireItemDependency"); const DojoAMDDefineDependency = require("./DojoAMDDefineDependency"); @@ -87,7 +89,7 @@ module.exports = class DojoAMDPlugin { compilation.dependencyFactories.set(DojoAMDRequireArrayDependency, new NullFactory()); compilation.dependencyTemplates.set(DojoAMDRequireArrayDependency, this.newRequireArrayDependencyTemplate(this.options, compilation)); - params.normalModuleFactory.hooks.parser.for('javascript/auto').tap('dojo-webpack-plugin', this.parserPlugins.bind(this)); + params.normalModuleFactory.hooks.parser.for('javascript/auto').tap(DojoAMDPlugin.pluginName, this.parserPlugins.bind(this)); } } @@ -95,8 +97,8 @@ module.exports = class DojoAMDPlugin { this.newRequireDependenciesBlockParserPlugin(this.options).apply(parser); this.newDefineDependencyParserPlugin(this.options).apply(parser); this.newDojoAMDMiscParserPlugin(this.options).apply(parser); - parser.hooks.expression.for('process').tap('dojo-webpack-plugin', this.expressionNode.bind(this, parser)); - parser.hooks.expression.for('global').tap('dojo-webpack-plugin', this.expressionNode.bind(this, parser)); + parser.hooks.expression.for('process').tap(DojoAMDPlugin.pluginName, this.expressionNode.bind(this, parser)); + parser.hooks.expression.for('global').tap(DojoAMDPlugin.pluginName, this.expressionNode.bind(this, parser)); } normalModuleReplacements() { diff --git a/package-lock.json b/package-lock.json index 8cbe424..f5d19cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "dojo-webpack-plugin", - "version": "3.0.3-rc1", + "version": "3.0.3-rc2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 96751e3..9fd084b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dojo-webpack-plugin", - "version": "3.0.3-rc1", + "version": "3.0.3-rc2", "author": "Chuck Dumont", "description": "Supports using webpack with Dojo 1.x applications", "scripts": {