@@ -258,27 +258,27 @@ class ContextModule extends Module {
258258 return typeof fakeMap === "object" ? `var fakeMap = ${ JSON . stringify ( fakeMap , null , "\t" ) } ;` : "" ;
259259 }
260260
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 })" ;
272269 }
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 ) } ;` ;
276276 }
277277
278278 getSyncSource ( dependencies , id ) {
279279 const map = this . getUserRequestMap ( dependencies ) ;
280280 const fakeMap = this . getFakeMap ( dependencies ) ;
281- const returnModuleObject = ` ${ this . getReturnModuleObjectSource ( fakeMap ) } ;` ;
281+ const returnModuleObject = this . getReturnModuleObjectSource ( fakeMap ) ;
282282
283283 return `var map = ${ JSON . stringify ( map , null , "\t" ) } ;
284284${ this . getFakeMapInitStatement ( fakeMap ) }
@@ -308,7 +308,7 @@ webpackContext.id = ${JSON.stringify(id)};`;
308308 getWeakSyncSource ( dependencies , id ) {
309309 const map = this . getUserRequestMap ( dependencies ) ;
310310 const fakeMap = this . getFakeMap ( dependencies ) ;
311- const returnModuleObject = ` ${ this . getReturnModuleObjectSource ( fakeMap ) } ;` ;
311+ const returnModuleObject = this . getReturnModuleObjectSource ( fakeMap ) ;
312312
313313 return `var map = ${ JSON . stringify ( map , null , "\t" ) } ;
314314${ this . getFakeMapInitStatement ( fakeMap ) }
@@ -343,7 +343,7 @@ module.exports = webpackContext;`;
343343 getAsyncWeakSource ( dependencies , id ) {
344344 const map = this . getUserRequestMap ( dependencies ) ;
345345 const fakeMap = this . getFakeMap ( dependencies ) ;
346- const returnModuleObject = ` ${ this . getReturnModuleObjectSource ( fakeMap ) } ;` ;
346+ const returnModuleObject = this . getReturnModuleObjectSource ( fakeMap ) ;
347347
348348 return `var map = ${ JSON . stringify ( map , null , "\t" ) } ;
349349${ this . getFakeMapInitStatement ( fakeMap ) }
@@ -386,7 +386,7 @@ module.exports = webpackAsyncContext;`;
386386 const thenFunction = fakeMap !== 1 ?
387387 `function(id) {
388388 var module = __webpack_require__(id);
389- ${ this . getReturnModuleObjectSource ( fakeMap ) } ;
389+ ${ this . getReturnModuleObjectSource ( fakeMap ) }
390390}` :
391391 "__webpack_require__" ;
392392 return `var map = ${ JSON . stringify ( map , null , "\t" ) } ;
@@ -485,7 +485,7 @@ module.exports = webpackAsyncContext;`;
485485 const requestPrefix = hasMultipleOrNoChunks ?
486486 `Promise.all(ids.slice(${ chunksStartPosition } ).map(__webpack_require__.e))` :
487487 `__webpack_require__.e(ids[${ chunksStartPosition } ])` ;
488- const returnModuleObject = ` ${ this . getReturnModuleObjectSource ( fakeMap , "ids[1]" ) } ;` ;
488+ const returnModuleObject = this . getReturnModuleObjectSource ( fakeMap , "ids[1]" ) ;
489489
490490 return `var map = ${ JSON . stringify ( map , null , "\t" ) } ;
491491function webpackAsyncContext(req) {
0 commit comments