mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
feat(ssr): add non async split chunk to preload scripts (#7383)
This commit is contained in:
parent
f4f6b1912b
commit
ffb9c65f46
@ -47,6 +47,7 @@ export default class VueSSRClientPlugin {
|
|||||||
assetsMapping
|
assetsMapping
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { entrypoints, namedChunkGroups } = stats
|
||||||
const assetModules = stats.modules.filter(m => m.assets.length)
|
const assetModules = stats.modules.filter(m => m.assets.length)
|
||||||
const fileToIndex = file => manifest.all.indexOf(file)
|
const fileToIndex = file => manifest.all.indexOf(file)
|
||||||
stats.modules.forEach((m) => {
|
stats.modules.forEach((m) => {
|
||||||
@ -58,7 +59,21 @@ export default class VueSSRClientPlugin {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const id = m.identifier.replace(/\s\w+$/, '') // remove appended hash
|
const id = m.identifier.replace(/\s\w+$/, '') // remove appended hash
|
||||||
const files = manifest.modules[hash(id)] = chunk.files.map(fileToIndex)
|
const filesSet = new Set(chunk.files.map(fileToIndex))
|
||||||
|
|
||||||
|
for (const chunkName of chunk.names) {
|
||||||
|
if (!entrypoints[chunkName]) {
|
||||||
|
const chunkGroup = namedChunkGroups[chunkName]
|
||||||
|
if (chunkGroup) {
|
||||||
|
for (const asset of chunkGroup.assets) {
|
||||||
|
filesSet.add(fileToIndex(asset))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const files = Array.from(filesSet)
|
||||||
|
manifest.modules[hash(id)] = files
|
||||||
|
|
||||||
// In production mode, modules may be concatenated by scope hoisting
|
// In production mode, modules may be concatenated by scope hoisting
|
||||||
// Include ConcatenatedModule for not losing module-component mapping
|
// Include ConcatenatedModule for not losing module-component mapping
|
||||||
|
Loading…
Reference in New Issue
Block a user