Skip to content

Commit b29c636

Browse files
committed
fix: match ef data routes
1 parent 1d868c7 commit b29c636

File tree

2 files changed

+16
-276
lines changed

2 files changed

+16
-276
lines changed

package-lock.json

Lines changed: 3 additions & 276 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/runtime/src/helpers/edge.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,10 @@ export const writeEdgeFunctions = async ({
472472
]),
473473
)
474474

475+
const dataRoutesMap = new Map(
476+
[...(routesManifest.dataRoutes || [])].map((route) => [route.page, route.dataRouteRegex]),
477+
)
478+
475479
for (const edgeFunctionDefinition of Object.values(middlewareManifest.functions)) {
476480
usesEdge = true
477481
const functionName = sanitizeName(edgeFunctionDefinition.name)
@@ -493,6 +497,15 @@ export const writeEdgeFunctions = async ({
493497
// cache: "manual" is currently experimental, so we restrict it to sites that use experimental appDir
494498
cache: usesAppDir ? 'manual' : undefined,
495499
})
500+
const dataRoute = dataRoutesMap.get(edgeFunctionDefinition.page)
501+
if (dataRoute) {
502+
manifest.functions.push({
503+
function: functionName,
504+
name: edgeFunctionDefinition.name,
505+
pattern: dataRoute,
506+
cache: usesAppDir ? 'manual' : undefined,
507+
})
508+
}
496509
}
497510
}
498511
if (usesEdge) {

0 commit comments

Comments
 (0)