diff --git a/src/server/webpack-plugin/client.js b/src/server/webpack-plugin/client.js index ae2a2498672..5c3edb6745b 100644 --- a/src/server/webpack-plugin/client.js +++ b/src/server/webpack-plugin/client.js @@ -45,6 +45,18 @@ export default class VueSSRClientPlugin { } const id = m.identifier.replace(/\s\w+$/, '') // remove appended hash const files = manifest.modules[hash(id)] = chunk.files.map(fileToIndex) + + // In production mode, modules may be concatenated by scope hoisting + // Include ConcatenatedModule for not losing module-component mapping + if (Array.isArray(m.modules)) { + for (const concatenatedModule of m.modules) { + const id = hash(concatenatedModule.identifier.replace(/\s\w+$/, '')) + if (!manifest.modules[id]) { + manifest.modules[id] = files + } + } + } + // find all asset modules associated with the same chunk assetModules.forEach(m => { if (m.chunks.some(id => id === cid)) {