@@ -122,17 +122,7 @@ module.exports = class DojoAMDMainTemplatePlugin {
122
122
}
123
123
}
124
124
125
- function hasAMD ( chunk ) {
126
- var modules = chunk . getModules ? chunk . getModules ( ) : chunk . modules ;
127
- return modules . some ( ( module ) => {
128
- return module . isAMD ;
129
- } ) ;
130
- }
131
-
132
125
compilation . mainTemplate . plugin ( "bootstrap" , function ( source , chunk ) {
133
- if ( ! compilation . dojoLoaderDependenciesAdded || ! hasAMD ( chunk ) ) {
134
- return source ;
135
- }
136
126
const buf = [ ] ;
137
127
const jsonpFunction = this . outputOptions . jsonpFunction || Template . toIdentifier ( "webpackJsonp" + ( this . outputOptions . library || "" ) ) ;
138
128
buf . push ( source ) ;
@@ -193,17 +183,11 @@ module.exports = class DojoAMDMainTemplatePlugin {
193
183
return this . asString ( buf ) ;
194
184
} ) ;
195
185
196
- compilation . mainTemplate . plugin ( "module-obj" , function ( source , chunk ) {
197
- if ( compilation . dojoLoaderDependenciesAdded && hasAMD ( chunk ) ) {
198
- source = source . replace ( "i: moduleId," , "i: req.absMidsById[moduleId] || moduleId," ) ;
199
- }
200
- return source ;
186
+ compilation . mainTemplate . plugin ( "module-obj" , function ( source ) {
187
+ return source . replace ( "i: moduleId," , "i: req.absMidsById[moduleId] || moduleId," ) ;
201
188
} ) ;
202
189
203
- compilation . mainTemplate . plugin ( "require-extensions" , function ( source , chunk ) {
204
- if ( ! compilation . dojoLoaderDependenciesAdded || ! hasAMD ( chunk ) ) {
205
- return source ;
206
- }
190
+ compilation . mainTemplate . plugin ( "require-extensions" , function ( source ) {
207
191
const buf = [ ] ;
208
192
buf . push ( source ) ;
209
193
buf . push ( "" ) ;
@@ -238,12 +222,10 @@ module.exports = class DojoAMDMainTemplatePlugin {
238
222
} ) ;
239
223
240
224
compilation . mainTemplate . plugin ( "hash" , function ( hash ) {
241
- if ( compilation . dojoLoaderDependenciesAdded ) {
242
- hash . update ( "DojoAMDMainTemplate" ) ;
243
- hash . update ( "3" ) ; // Increment this whenever the template code above changes
244
- if ( ! util . isString ( options . loaderConfig ) ) {
245
- hash . update ( JSON . stringify ( options . loaderConfig ) ) ;
246
- }
225
+ hash . update ( "DojoAMDMainTemplate" ) ;
226
+ hash . update ( "3" ) ; // Increment this whenever the template code above changes
227
+ if ( ! util . isString ( options . loaderConfig ) ) {
228
+ hash . update ( JSON . stringify ( options . loaderConfig ) ) ;
247
229
}
248
230
} ) ;
249
231
}
0 commit comments