mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 21:07:46 +00:00
Fix index normalizing for app outputs (#11099)
This ensures we don't apply the index output normalizing for app paths which was previously already gated for prerenders but not all routes.
This commit is contained in:
@@ -2053,6 +2053,11 @@ export const onPrerenderRoute =
|
||||
|
||||
let isAppPathRoute = false;
|
||||
|
||||
// experimentalPPR signals app path route
|
||||
if (appDir && experimentalPPR) {
|
||||
isAppPathRoute = true;
|
||||
}
|
||||
|
||||
// TODO: leverage manifest to determine app paths more accurately
|
||||
if (appDir && srcRoute && (!dataRoute || dataRoute?.endsWith('.rsc'))) {
|
||||
isAppPathRoute = true;
|
||||
@@ -2184,7 +2189,6 @@ export const onPrerenderRoute =
|
||||
if (routeKey !== '/index' && routeKey.endsWith('/index')) {
|
||||
routeKey = `${routeKey}/index`;
|
||||
routeFileNoExt = routeKey;
|
||||
origRouteFileNoExt = routeKey;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2255,15 +2259,20 @@ export const onPrerenderRoute =
|
||||
const lambdaId = pageLambdaMap[outputSrcPathPage];
|
||||
lambda = lambdas[lambdaId];
|
||||
} else {
|
||||
const outputSrcPathPage = normalizeIndexOutput(
|
||||
let outputSrcPathPage =
|
||||
srcRoute == null
|
||||
? outputPathPageOrig
|
||||
: path.posix.join(
|
||||
entryDirectory,
|
||||
srcRoute === '/' ? '/index' : srcRoute
|
||||
),
|
||||
isServerMode
|
||||
);
|
||||
);
|
||||
|
||||
if (!isAppPathRoute) {
|
||||
outputSrcPathPage = normalizeIndexOutput(
|
||||
outputSrcPathPage,
|
||||
isServerMode
|
||||
);
|
||||
}
|
||||
|
||||
lambda = lambdas[outputSrcPathPage];
|
||||
}
|
||||
@@ -2464,11 +2473,18 @@ export const onPrerenderRoute =
|
||||
routesManifest,
|
||||
locale
|
||||
);
|
||||
const localeOutputPathPage = normalizeIndexOutput(
|
||||
path.posix.join(entryDirectory, localeRouteFileNoExt),
|
||||
isServerMode
|
||||
let localeOutputPathPage = path.posix.join(
|
||||
entryDirectory,
|
||||
localeRouteFileNoExt
|
||||
);
|
||||
|
||||
if (!isAppPathRoute) {
|
||||
localeOutputPathPage = normalizeIndexOutput(
|
||||
localeOutputPathPage,
|
||||
isServerMode
|
||||
);
|
||||
}
|
||||
|
||||
const origPrerenderPage = prerenders[outputPathPage];
|
||||
prerenders[localeOutputPathPage] = {
|
||||
...origPrerenderPage,
|
||||
@@ -2969,14 +2985,17 @@ export async function getMiddlewareBundle({
|
||||
}
|
||||
|
||||
if (routesManifest?.basePath) {
|
||||
shortPath = normalizeIndexOutput(
|
||||
path.posix.join(
|
||||
'./',
|
||||
routesManifest?.basePath,
|
||||
shortPath.replace(/^\//, '')
|
||||
),
|
||||
true
|
||||
const isAppPathRoute = !!appPathRoutesManifest[shortPath];
|
||||
|
||||
shortPath = path.posix.join(
|
||||
'./',
|
||||
routesManifest?.basePath,
|
||||
shortPath.replace(/^\//, '')
|
||||
);
|
||||
|
||||
if (!isAppPathRoute) {
|
||||
shortPath = normalizeIndexOutput(shortPath, true);
|
||||
}
|
||||
}
|
||||
|
||||
worker.edgeFunction.name = shortPath;
|
||||
|
||||
Reference in New Issue
Block a user