mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix: lazy is true by default
This commit is contained in:
parent
cd0dd009e0
commit
68fc208299
@ -121,9 +121,9 @@ export const getRollupConfig = (sigmaContext: SigmaContext) => {
|
|||||||
const getImportId = p => '_' + hasha(p).substr(0, 6)
|
const getImportId = p => '_' + hasha(p).substr(0, 6)
|
||||||
rollupConfig.plugins.push(virtual({
|
rollupConfig.plugins.push(virtual({
|
||||||
'~serverMiddleware': `
|
'~serverMiddleware': `
|
||||||
${sigmaContext.middleware.filter(m => !m.lazy).map(m => `import ${getImportId(m.handle)} from '${m.handle}';`).join('\n')}
|
${sigmaContext.middleware.filter(m => m.lazy === false).map(m => `import ${getImportId(m.handle)} from '${m.handle}';`).join('\n')}
|
||||||
|
|
||||||
${sigmaContext.middleware.filter(m => m.lazy).map(m => `const ${getImportId(m.handle)} = () => import('${m.handle}');`).join('\n')}
|
${sigmaContext.middleware.filter(m => m.lazy !== false).map(m => `const ${getImportId(m.handle)} = () => import('${m.handle}');`).join('\n')}
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
${sigmaContext.middleware.map(m => `{ route: '${m.route}', handle: ${getImportId(m.handle)}, lazy: ${m.lazy || true}, promisify: ${m.promisify || true} }`).join(',\n')}
|
${sigmaContext.middleware.map(m => `{ route: '${m.route}', handle: ${getImportId(m.handle)}, lazy: ${m.lazy || true}, promisify: ${m.promisify || true} }`).join(',\n')}
|
||||||
|
Loading…
Reference in New Issue
Block a user