Skip to content

Commit

Permalink
fix: enable lazy only when explicitly set (enable for api and rotues …
Browse files Browse the repository at this point in the history
…by default)
  • Loading branch information
pi0 committed May 5, 2022
1 parent 23d8cde commit 247cfca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rollup/plugins/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ${imports.map(handler => `import ${getImportId(handler)} from '${handler}';`).jo
${lazyImports.map(handler => `const ${getImportId(handler)} = () => import('${handler}');`).join('\n')}
export const handlers = [
${handlers.map(h => ` { route: '${h.route || ''}', handler: ${getImportId(h.handler)}, lazy: ${h.lazy || true}, middleware: ${!!h.middleware}, method: ${JSON.stringify(h.method)} }`).join(',\n')}
${handlers.map(h => ` { route: '${h.route || ''}', handler: ${getImportId(h.handler)}, lazy: ${!!h.lazy}, middleware: ${!!h.middleware}, method: ${JSON.stringify(h.method)} }`).join(',\n')}
];
`.trim()
return code
Expand Down
1 change: 1 addition & 0 deletions src/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function scanRoutes (nitro: Nitro, dir: string, prefix: string = '/') {

return {
handler: file.fullPath,
lazy: true,
route,
method
}
Expand Down

0 comments on commit 247cfca

Please sign in to comment.