Skip to content

Commit

Permalink
Merge pull request #288 from chuckdumont/work
Browse files Browse the repository at this point in the history
Handle case where another AMD loader (e.g. requirejs) is already loaded.
  • Loading branch information
chuckdumont authored Jun 18, 2020
2 parents 980a30d + c1ba099 commit 5e8922e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions lib/DojoAMDMainTemplatePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ module.exports = class DojoAMDMainTemplatePlugin {
buf.push(" window:{value:loaderScope},");
buf.push(" global:{value:loaderScope}");
buf.push("});");
// Remove evidence of any existing AMD loader or else the Dojo loader won't initialize properly.
buf.push("loaderScope.define = loaderScope.require = undefined");

const dojoLoaderModule = this.compilation.modules.find((module) => { return module.rawRequest === this.embeddedLoaderFilename;});
if (!dojoLoaderModule) {
throw Error("Can't locate " + this.embeddedLoaderFilename + " in compilation");
Expand Down
14 changes: 7 additions & 7 deletions 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": "2.8.14",
"version": "2.8.15-rc1",
"author": "Chuck Dumont",
"description": "Supports using webpack with Dojo 1.x applications",
"scripts": {
Expand Down

0 comments on commit 5e8922e

Please sign in to comment.