fix: only support lazycompile in dev mode

This commit is contained in:
ClarkXia 2024-09-02 15:30:19 +08:00
parent 3280dbf433
commit cb35145ff3
1 changed files with 2 additions and 2 deletions

View File

@ -253,7 +253,7 @@ async function createService({ rootDir, command, commandArgs }: CreateServiceOpt
const { routeImports, routeDefinition } = getRoutesDefinition({
manifest: routesInfo.routes,
lazy,
compileRoutes: routesConfig?.lazyCompile ? [commandArgs.open || '/'] : undefined,
compileRoutes: routesConfig?.lazyCompile && command === 'start' ? [commandArgs.open || '/'] : undefined,
});
const loaderExports = hasExportAppData || Boolean(routesInfo.loaders);
const hasDataLoader = Boolean(userConfig.dataLoader) && loaderExports;
@ -303,7 +303,7 @@ async function createService({ rootDir, command, commandArgs }: CreateServiceOpt
generator.addRenderFile('core/entry.server.ts.ejs', FALLBACK_ENTRY, { hydrate: false });
}
if (routesConfig?.lazyCompile) {
if (routesConfig?.lazyCompile && command === 'start') {
generator.addRenderFile('core/empty.tsx.ejs', 'empty.tsx');
}
if (typeof userConfig.dataLoader === 'object' && userConfig.dataLoader.fetcher) {