@@ -258,27 +258,27 @@ class ContextModule extends Module {
258
258
return typeof fakeMap === "object" ? `var fakeMap = ${ JSON . stringify ( fakeMap , null , "\t" ) } ;` : "" ;
259
259
}
260
260
261
- getReturnModuleObjectSource ( fakeMap , fakeMapDataExpression = "fakeMap[id]" ) {
262
- const strict = this . options . namespaceObject === "strict" ;
263
- const getReturn = type => {
264
- if ( type === 1 ) return "module" ;
265
- if ( type === 2 ) return "Object.assign({/* fake namespace object */}, module, { \"default\": module })" ;
266
- if ( type === 0 ) {
267
- if ( strict ) {
268
- return "/* fake namespace object */ { \"default\": module }" ;
269
- } else {
270
- return "(typeof module === \"object\" && module && module.__esModule ? module : /* fake namespace object */ { \"default\": module })" ;
271
- }
261
+ getReturn ( type ) {
262
+ if ( type === 1 ) return "module" ;
263
+ if ( type === 2 ) return "Object.assign({/* fake namespace object */}, module, { \"default\": module })" ;
264
+ if ( type === 0 ) {
265
+ if ( this . options . namespaceObject === "strict" ) {
266
+ return "/* fake namespace object */ { \"default\": module }" ;
267
+ } else {
268
+ return "(typeof module === \"object\" && module && module.__esModule ? module : /* fake namespace object */ { \"default\": module })" ;
272
269
}
273
- } ;
274
- if ( typeof fakeMap === "number" ) return `return ${ getReturn ( fakeMap ) } ;` ;
275
- return `return ${ fakeMapDataExpression } === 1 ? ${ getReturn ( 1 ) } : ${ fakeMapDataExpression } ? ${ getReturn ( 2 ) } : ${ getReturn ( 0 ) } ;` ;
270
+ }
271
+ }
272
+
273
+ getReturnModuleObjectSource ( fakeMap , fakeMapDataExpression = "fakeMap[id]" ) {
274
+ if ( typeof fakeMap === "number" ) return `return ${ this . getReturn ( fakeMap ) } ;` ;
275
+ return `return ${ fakeMapDataExpression } === 1 ? ${ this . getReturn ( 1 ) } : ${ fakeMapDataExpression } ? ${ this . getReturn ( 2 ) } : ${ this . getReturn ( 0 ) } ;` ;
276
276
}
277
277
278
278
getSyncSource ( dependencies , id ) {
279
279
const map = this . getUserRequestMap ( dependencies ) ;
280
280
const fakeMap = this . getFakeMap ( dependencies ) ;
281
- const returnModuleObject = ` ${ this . getReturnModuleObjectSource ( fakeMap ) } ;` ;
281
+ const returnModuleObject = this . getReturnModuleObjectSource ( fakeMap ) ;
282
282
283
283
return `var map = ${ JSON . stringify ( map , null , "\t" ) } ;
284
284
${ this . getFakeMapInitStatement ( fakeMap ) }
@@ -308,7 +308,7 @@ webpackContext.id = ${JSON.stringify(id)};`;
308
308
getWeakSyncSource ( dependencies , id ) {
309
309
const map = this . getUserRequestMap ( dependencies ) ;
310
310
const fakeMap = this . getFakeMap ( dependencies ) ;
311
- const returnModuleObject = ` ${ this . getReturnModuleObjectSource ( fakeMap ) } ;` ;
311
+ const returnModuleObject = this . getReturnModuleObjectSource ( fakeMap ) ;
312
312
313
313
return `var map = ${ JSON . stringify ( map , null , "\t" ) } ;
314
314
${ this . getFakeMapInitStatement ( fakeMap ) }
@@ -343,7 +343,7 @@ module.exports = webpackContext;`;
343
343
getAsyncWeakSource ( dependencies , id ) {
344
344
const map = this . getUserRequestMap ( dependencies ) ;
345
345
const fakeMap = this . getFakeMap ( dependencies ) ;
346
- const returnModuleObject = ` ${ this . getReturnModuleObjectSource ( fakeMap ) } ;` ;
346
+ const returnModuleObject = this . getReturnModuleObjectSource ( fakeMap ) ;
347
347
348
348
return `var map = ${ JSON . stringify ( map , null , "\t" ) } ;
349
349
${ this . getFakeMapInitStatement ( fakeMap ) }
@@ -386,7 +386,7 @@ module.exports = webpackAsyncContext;`;
386
386
const thenFunction = fakeMap !== 1 ?
387
387
`function(id) {
388
388
var module = __webpack_require__(id);
389
- ${ this . getReturnModuleObjectSource ( fakeMap ) } ;
389
+ ${ this . getReturnModuleObjectSource ( fakeMap ) }
390
390
}` :
391
391
"__webpack_require__" ;
392
392
return `var map = ${ JSON . stringify ( map , null , "\t" ) } ;
@@ -485,7 +485,7 @@ module.exports = webpackAsyncContext;`;
485
485
const requestPrefix = hasMultipleOrNoChunks ?
486
486
`Promise.all(ids.slice(${ chunksStartPosition } ).map(__webpack_require__.e))` :
487
487
`__webpack_require__.e(ids[${ chunksStartPosition } ])` ;
488
- const returnModuleObject = ` ${ this . getReturnModuleObjectSource ( fakeMap , "ids[1]" ) } ;` ;
488
+ const returnModuleObject = this . getReturnModuleObjectSource ( fakeMap , "ids[1]" ) ;
489
489
490
490
return `var map = ${ JSON . stringify ( map , null , "\t" ) } ;
491
491
function webpackAsyncContext(req) {
0 commit comments