fix: Use file path for chunkName

This commit is contained in:
Sebastien Chopin 2017-08-25 12:34:59 +02:00
parent cb8bc559b4
commit 7bc1b35b21
2 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@ function recursiveRoutes(routes, tab, components) {
}
const _components = []
const _routes = recursiveRoutes(router.routes, '\t\t', _components)
uniqBy(_components, '_name').forEach((route) => { %>const <%= route._name %> = () => import('<%= relativeToBuild(route.component) %>' /* webpackChunkName: "<%= wChunk('pages/' + route.chunkName) %>" */).then(m => m.default || m)
uniqBy(_components, '_name').forEach((route) => { %>const <%= route._name %> = () => import('<%= relativeToBuild(route.component) %>' /* webpackChunkName: "<%= wChunk(route.chunkName) %>" */).then(m => m.default || m)
<% }) %>
<% if (router.scrollBehavior) { %>

View File

@ -216,7 +216,7 @@ export function createRoutes (files, srcDir) {
keys.forEach((key, i) => {
route.name = route.name ? route.name + '-' + key.replace('_', '') : key.replace('_', '')
route.name += (key === '_') ? 'all' : ''
route.chunkName = route.name
route.chunkName = file.replace(/\.vue$/, '')
let child = _.find(parent, { name: route.name })
if (child) {
if (!child.children) {