Skip to content

Commit

Permalink
Don't include our runtime modules in build time chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckdumont committed Oct 28, 2021
1 parent 00363a0 commit 37f3dc2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
16 changes: 9 additions & 7 deletions lib/DojoAMDPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -87,16 +89,16 @@ 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));
}
}

parserPlugins(parser) {
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() {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit 37f3dc2

Please sign in to comment.