Skip to content

Commit

Permalink
Merge pull request #340 from chuckdumont/work
Browse files Browse the repository at this point in the history
Fix djProp name collision detection for HRM.  This resolves #339
  • Loading branch information
chuckdumont authored Jun 16, 2021
2 parents e0126dc + 0d94846 commit 181f5d2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/DojoAMDRuntimeModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ class DojoAMDRuntimeModule extends RuntimeModule {
*/
generate() {
const pluginProps = getPluginProps(this.compilation.compiler);
const djProp = `__webpack_require__.${this.options.requireFnPropName}`;
const [runtimeSource, asyncSource] = ['main', 'async'].map(type => Template.getFunctionContent(runtime[type])
.replace(/__async__/g, (!!this.options.async).toString()));
.replace(/__async__/g, (!!this.options.async).toString())
.replace('__webpack_require__.dj', djProp));
const chunkLoadingGlobal = JSON.stringify(this.compilation.outputOptions.chunkLoadingGlobal);
const buf = [];

Expand All @@ -45,10 +47,10 @@ class DojoAMDRuntimeModule extends RuntimeModule {
}
buf.push("");
buf.push("// expose the Dojo compatibility functions as a properties of __webpack_require__");
const djProp = `__webpack_require__.${this.options.requireFnPropName}`;
buf.push(`if (${djProp}) throw new Error("${djProp} name collision.")`);
buf.push(`if (${djProp} && ${djProp}.name !== '${pluginName}') throw new Error("${djProp} name collision.")`);
buf.push(`${djProp} = {`);
buf.push(Template.indent([
`name: '${pluginName}',`,
"r: req,",
"c: createContextRequire,",
"m: dojoModuleFromWebpackModule,",
Expand Down

0 comments on commit 181f5d2

Please sign in to comment.