Skip to content

Commit

Permalink
Merge pull request #172 from maier49/fix-chunk-emit
Browse files Browse the repository at this point in the history
Emit `registerAbsMids` call before chunk code
  • Loading branch information
chuckdumont authored Jul 26, 2018
2 parents 3123e11 + fce44ac commit ba87817
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/DojoAMDChunkTemplatePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

const {reg, tap, callSyncWaterfall} = require("webpack-plugin-compat").for("dojo-webpack-plugin");
const {getIndent, getAsString, modulesFromChunk} = require("./compat");
const {ConcatSource} = require('webpack-sources');

module.exports = class DojoAMDChunkTemplatePlugin {
constructor(options) {
Expand Down Expand Up @@ -52,14 +53,12 @@ module.exports = class DojoAMDChunkTemplatePlugin {
const jsonpFn = JSON.stringify(chunkTemplate.outputOptions.jsonpFunction);

const buf = [];
buf.push(";");
buf.push("(function(){");
buf.push(`(this||window)[${jsonpFn}].registerAbsMids({`);
buf.push(callSyncWaterfall(chunkTemplate, "render absMids", "", chunk));
buf.push("})");
buf.push("})()");
source.add(this.asString(buf));
return source;
buf.push("})(),");
return new ConcatSource(this.asString(buf), source);
}

renderAbsMids(source, chunk) {
Expand Down

0 comments on commit ba87817

Please sign in to comment.