diff --git a/lib/dependencies/DepBlockHelpers.js b/lib/dependencies/DepBlockHelpers.js index ebf977fe94f..9f099b16aec 100644 --- a/lib/dependencies/DepBlockHelpers.js +++ b/lib/dependencies/DepBlockHelpers.js @@ -18,14 +18,16 @@ DepBlockHelpers.getLoadDepBlockWrapper = (depBlock, outputOptions, requestShorte DepBlockHelpers.getDepBlockPromise = (depBlock, outputOptions, requestShortener, name) => { if(depBlock.chunks) { const chunks = depBlock.chunks.filter(chunk => !chunk.hasRuntime() && chunk.id !== null); - const pathAndChunkCheck = outputOptions.pathinfo && depBlock.chunkName; - const shortenedChunkName = requestShortener.shorten(depBlock.chunkName); + const pathChunkCheck = outputOptions.pathinfo && depBlock.chunkName; + const shortChunkName = requestShortener.shorten(depBlock.chunkName); const chunkReason = asComment(depBlock.chunkReason); + const requireChunkId = chunk => "__webpack_require__.e(" + JSON.stringify(chunk.id) + ")"; + name = asComment(name); if(chunks.length === 1) { const chunkId = JSON.stringify(chunks[0].id); - return `__webpack_require__.e${asComment(name)}(${chunkId}${pathAndChunkCheck ? "/*! " + shortenedChunkName + " */" : ""}${chunkReason})`; + return `__webpack_require__.e${name}(${chunkId}${pathChunkCheck ? "/*! " + shortChunkName + " */" : ""}${chunkReason})`; } else if(chunks.length > 0) { - return `Promise.all${asComment(name)}(${pathAndChunkCheck ? "/*! " + shortenedChunkName + " */" : ""}[${chunks.map(chunk => "__webpack_require__.e(" + JSON.stringify(chunk.id) + ")").join(", ")}])`; + return `Promise.all${name}(${pathChunkCheck ? "/*! " + shortChunkName + " */" : ""}[${chunks.map(requireChunkId).join(", ")}])`; } } return "new Promise(function(resolve) { resolve(); })";