[next] add .action handling for dynamic routes (#11461)

Follow-up to:
- https://github.com/vercel/vercel/pull/11454

Adds similar handling for dynamic routes
This commit is contained in:
Zack Tanner
2024-04-18 12:04:30 -07:00
committed by GitHub
parent 596b68ce56
commit 5bb96ea072
4 changed files with 52 additions and 0 deletions

View File

@@ -432,6 +432,15 @@ export async function getDynamicRoutes({
dest: route.dest?.replace(/($|\?)/, '.rsc$1'),
});
routes.push({
...route,
src: route.src.replace(
new RegExp(escapeStringRegexp('(?:/)?$')),
'(?:\\.action)(?:/)?$'
),
dest: route.dest?.replace(/($|\?)/, '.action$1'),
});
routes.push(route);
}