fix: lazy is true by default

This commit is contained in:
Pooya Parsa 2020-11-20 21:11:46 +01:00
parent cd0dd009e0
commit 68fc208299

View File

@ -121,9 +121,9 @@ export const getRollupConfig = (sigmaContext: SigmaContext) => {
const getImportId = p => '_' + hasha(p).substr(0, 6)
rollupConfig.plugins.push(virtual({
'~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 [
${sigmaContext.middleware.map(m => `{ route: '${m.route}', handle: ${getImportId(m.handle)}, lazy: ${m.lazy || true}, promisify: ${m.promisify || true} }`).join(',\n')}