fix(vue-app): sanitize layouts after resolve for splitChunks.layout (#7139)

This commit is contained in:
Pooya Parsa 2020-03-27 14:08:48 +01:00 committed by GitHub
parent d46c2dd4ff
commit 06073697f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -18,15 +18,19 @@ import '<%= relativeToBuild(resolvePath(c.src || c, { isStyle: true })) %>'
<% if (features.layouts) { %> <% if (features.layouts) { %>
<%= Object.keys(layouts).map((key) => { <%= Object.keys(layouts).map((key) => {
if (splitChunks.layouts) { 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 { } else {
return `import _${hash(key)} from '${layouts[key]}'` return `import _${hash(key)} from '${layouts[key]}'`
} }
}).join('\n') %> }).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' : '' %> const layouts = { <%= Object.keys(layouts).map(key => `"_${key}": sanitizeComponent(_${hash(key)})`).join(',') %> }<%= isTest ? '// eslint-disable-line' : '' %>
<% } %>
<% if (splitChunks.layouts) { %>let resolvedLayouts = {}<% } %>
<% } %> <% } %>
export default { export default {

View File

@ -81,6 +81,9 @@ export default {
scopeHoisting: true, scopeHoisting: true,
publicPath: '', publicPath: '',
followSymlinks: true, followSymlinks: true,
splitChunks: {
layouts: true
},
postcss: { postcss: {
preset: { preset: {
features: { features: {