mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-17 06:01:34 +00:00
fix: Use file path for chunkName
This commit is contained in:
parent
cb8bc559b4
commit
7bc1b35b21
@ -20,7 +20,7 @@ function recursiveRoutes(routes, tab, components) {
|
|||||||
}
|
}
|
||||||
const _components = []
|
const _components = []
|
||||||
const _routes = recursiveRoutes(router.routes, '\t\t', _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) { %>
|
<% if (router.scrollBehavior) { %>
|
||||||
|
@ -216,7 +216,7 @@ export function createRoutes (files, srcDir) {
|
|||||||
keys.forEach((key, i) => {
|
keys.forEach((key, i) => {
|
||||||
route.name = route.name ? route.name + '-' + key.replace('_', '') : key.replace('_', '')
|
route.name = route.name ? route.name + '-' + key.replace('_', '') : key.replace('_', '')
|
||||||
route.name += (key === '_') ? 'all' : ''
|
route.name += (key === '_') ? 'all' : ''
|
||||||
route.chunkName = route.name
|
route.chunkName = file.replace(/\.vue$/, '')
|
||||||
let child = _.find(parent, { name: route.name })
|
let child = _.find(parent, { name: route.name })
|
||||||
if (child) {
|
if (child) {
|
||||||
if (!child.children) {
|
if (!child.children) {
|
||||||
|
Loading…
Reference in New Issue
Block a user