fix(webpack): fix production font preloading (#5436)

This commit is contained in:
Xin Du (Clark) 2019-04-20 13:05:14 +01:00 committed by GitHub
parent f5bbc585ee
commit aea9db6f56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,6 +60,17 @@ 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)) {