mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
fix(vue-app): sanitize layouts after resolve for splitChunks.layout
(#7139)
This commit is contained in:
parent
d46c2dd4ff
commit
06073697f4
@ -18,15 +18,19 @@ import '<%= relativeToBuild(resolvePath(c.src || c, { isStyle: true })) %>'
|
||||
<% if (features.layouts) { %>
|
||||
<%= 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]}' /* webpackChunkName: "${wChunk('layouts/' + key)}" */).then(m => sanitizeComponent(m.default || m))`
|
||||
} else {
|
||||
return `import _${hash(key)} from '${layouts[key]}'`
|
||||
}
|
||||
}).join('\n') %>
|
||||
|
||||
<% if (splitChunks.layouts) { %>
|
||||
let resolvedLayouts = {}
|
||||
const layouts = { <%= Object.keys(layouts).map(key => `"_${key}": _${hash(key)}`).join(',') %> }<%= isTest ? '// eslint-disable-line' : '' %>
|
||||
<% } else { %>
|
||||
const layouts = { <%= Object.keys(layouts).map(key => `"_${key}": sanitizeComponent(_${hash(key)})`).join(',') %> }<%= isTest ? '// eslint-disable-line' : '' %>
|
||||
<% } %>
|
||||
|
||||
<% if (splitChunks.layouts) { %>let resolvedLayouts = {}<% } %>
|
||||
<% } %>
|
||||
|
||||
export default {
|
||||
|
3
test/fixtures/basic/nuxt.config.js
vendored
3
test/fixtures/basic/nuxt.config.js
vendored
@ -81,6 +81,9 @@ export default {
|
||||
scopeHoisting: true,
|
||||
publicPath: '',
|
||||
followSymlinks: true,
|
||||
splitChunks: {
|
||||
layouts: true
|
||||
},
|
||||
postcss: {
|
||||
preset: {
|
||||
features: {
|
||||
|
Loading…
Reference in New Issue
Block a user