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
parent d1479d11c7
commit 09b141efa4
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}'`
}