@@ -93,6 +93,7 @@ module.exports = class DojoAMDMainTemplatePlugin {
93
93
const [ runtimeSource , asyncSource ] = [ 'main' , 'async' ] . map ( type => Template . getFunctionContent ( runtime [ type ] )
94
94
. replace ( / _ _ w e b p a c k _ r e q u i r e _ _ / g, mainTemplate . requireFn )
95
95
. replace ( / _ _ a s y n c _ _ / g, ( ! ! this . options . async ) . toString ( ) ) ) ;
96
+ const jsonpFn = JSON . stringify ( mainTemplate . outputOptions . jsonpFunction ) ;
96
97
const buf = [ ] ;
97
98
buf . push ( runtimeSource ) ;
98
99
if ( this . options . async ) {
@@ -105,7 +106,6 @@ module.exports = class DojoAMDMainTemplatePlugin {
105
106
buf . push ( "" ) ;
106
107
buf . push ( ( callSyncWaterfall ( mainTemplate , "dojo-global-require" , "globalObj.require = req;" ) ) ) ;
107
108
if ( needChunkLoadingCode ( chunk ) ) {
108
- const jsonpFn = JSON . stringify ( mainTemplate . outputOptions . jsonpFunction ) ;
109
109
buf . push ( this . indent (
110
110
`(this||window)[${ jsonpFn } ].registerAbsMids = registerAbsMids;`
111
111
) ) ;
@@ -170,6 +170,13 @@ but the loader specified at ${this.embeddedLoaderFilename} was built without the
170
170
if ( loaderConfig . has && loaderConfig . has [ 'dojo-undef-api' ] ) {
171
171
buf . push ( "req.undef = " + Template . getFunctionContent ( runtime . undef ) ) ;
172
172
}
173
+ if ( needChunkLoadingCode ( chunk ) ) {
174
+ buf . push ( `var absMidsWaiting = globalObj[${ jsonpFn } ].absMidsWaiting;` ) ;
175
+ buf . push ( "if (absMidsWaiting) {" ) ;
176
+ buf . push ( " absMidsWaiting.forEach(registerAbsMids);" ) ;
177
+ buf . push ( ` delete globalObj[${ jsonpFn } ].absMidsWaiting;` ) ;
178
+ buf . push ( "}" ) ;
179
+ }
173
180
const makeDeprecatedReq = Template . getFunctionContent ( runtime . makeDeprecatedReq )
174
181
. replace ( / _ _ w e b p a c k _ r e q u i r e _ _ \. d j / g, djProp ) ;
175
182
return this . asString ( [
@@ -230,7 +237,7 @@ but the loader specified at ${this.embeddedLoaderFilename} was built without the
230
237
hash ( hash ) {
231
238
const { options} = this ;
232
239
hash . update ( "DojoAMDMainTemplate" ) ;
233
- hash . update ( "11 " ) ; // Increment this whenever the template code above changes
240
+ hash . update ( "12 " ) ; // Increment this whenever the template code above changes
234
241
if ( util . isString ( options . loaderConfig ) ) {
235
242
hash . update ( options . loaderConfig ) ; // loading the config as a module, so any any changes to the
236
243
// content will be detected at the module level
0 commit comments