mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
feat: add webpackPrefetch to initial async chunk options (webpack 4.6.0)
This commit is contained in:
parent
d1479d11c7
commit
09b141efa4
@ -6,7 +6,7 @@ import '<%= relativeToBuild(resolvePath(c.src || c)) %>'
|
||||
|
||||
<%= Object.keys(layouts).map(key => {
|
||||
if (splitChunks.layouts) {
|
||||
return `const _${hash(key)} = () => import('${layouts[key]}' /* webpackChunkName: "${wChunk('layouts/' + key)}" */).then(m => m.default || m)`
|
||||
return `const _${hash(key)} = () => import('${layouts[key]}' /* webpackPrefetch: true, webpackChunkName: "${wChunk('layouts/' + key)}" */).then(m => m.default || m)`
|
||||
} else {
|
||||
return `import _${hash(key)} from '${layouts[key]}'`
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ const _routes = recursiveRoutes(router.routes, '\t\t', _components)
|
||||
const name = route._name
|
||||
|
||||
if (splitChunks.pages) {
|
||||
return `const ${name} = () => import('${path}' /* webpackChunkName: "${chunkName}" */).then(m => m.default || m)`
|
||||
return `const ${name} = () => import('${path}' /* webpackPrefetch: true, webpackChunkName: "${chunkName}" */).then(m => m.default || m)`
|
||||
} else {
|
||||
return `import ${name} from '${path}'`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user