feat: add webpackPrefetch to initial async chunk options (webpack 4.6.0)

This commit is contained in:
Pooya Parsa 2018-05-02 13:42:21 +04:30 committed by Pooya Parsa
parent 2428a13c05
commit aec6828892
2 changed files with 2 additions and 2 deletions

View File

@ -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]}'`
}

View File

@ -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}'`
}