Skip to content

Commit 9f54714

Browse files
committed
fix: rebuild dynamic routes cache on server restart
follow up on #4525
1 parent 7a9ae34 commit 9f54714

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/node/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export async function resolveConfig(
130130
userConfig,
131131
sitemap: userConfig.sitemap,
132132
buildConcurrency: userConfig.buildConcurrency ?? 64,
133-
...(await resolvePages(srcDir, userConfig, logger))
133+
...(await resolvePages(srcDir, userConfig, logger, true))
134134
}
135135

136136
// to be shared with content loaders

src/node/plugins/dynamicRoutesPlugin.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,14 @@ export function defineRoutes(loader: RouteModule) {
7070
export async function resolvePages(
7171
srcDir: string,
7272
userConfig: UserConfig,
73-
logger: Logger
73+
logger: Logger,
74+
rebuildCache = false
7475
): Promise<Pick<SiteConfig, 'pages' | 'dynamicRoutes' | 'rewrites'>> {
76+
if (rebuildCache) {
77+
moduleGraph = new ModuleGraph()
78+
routeModuleCache.clear()
79+
}
80+
7581
// Important: tinyglobby doesn't guarantee order of the returned files.
7682
// We must sort the pages so the input list to rollup is stable across
7783
// builds - otherwise different input order could result in different exports

0 commit comments

Comments
 (0)