fix(build): reset regex lastIndex before testing

pull/2314/head
Divyansh Singh 2 years ago
parent a647cd3843
commit 188893c2c1

@ -27,10 +27,14 @@ export async function resolvePages(srcDir: string, userConfig: UserConfig) {
}) })
).sort() ).sort()
const pages = allMarkdownFiles.filter((p) => !dynamicRouteRE.test(p)) const pages: string[] = []
const dynamicRouteFiles = allMarkdownFiles.filter((p) => const dynamicRouteFiles: string[] = []
dynamicRouteRE.test(p)
) allMarkdownFiles.forEach((file) => {
dynamicRouteRE.lastIndex = 0
;(dynamicRouteRE.test(file) ? dynamicRouteFiles : pages).push(file)
})
const dynamicRoutes = await resolveDynamicRoutes(srcDir, dynamicRouteFiles) const dynamicRoutes = await resolveDynamicRoutes(srcDir, dynamicRouteFiles)
pages.push(...dynamicRoutes.routes.map((r) => r.path)) pages.push(...dynamicRoutes.routes.map((r) => r.path))

Loading…
Cancel
Save