From 406a861c3d8deadfc04cdfa20837935bd6f540eb Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Thu, 4 Jan 2024 19:02:57 +0100 Subject: [PATCH] Ensure appPathsManifest variable is inside if block (#60210) ## What? I noticed that this variable is only used to write the manifest to disk so it doesn't have to be kept around in the function scope. Closes NEXT-1980 --- packages/next/src/build/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts index f19fde7919..001a9a4ab0 100644 --- a/packages/next/src/build/index.ts +++ b/packages/next/src/build/index.ts @@ -1497,17 +1497,17 @@ export default async function build( ? await readManifest(appBuildManifestPath) : undefined - let appPathsManifest: Record = {} const appPathRoutes: Record = {} if (appDir) { - appPathsManifest = await readManifest( + const appPathsManifest = await readManifest>( path.join(distDir, SERVER_DIRECTORY, APP_PATHS_MANIFEST) ) - Object.keys(appPathsManifest).forEach((entry) => { - appPathRoutes[entry] = normalizeAppPath(entry) - }) + for (const key in appPathsManifest) { + appPathRoutes[key] = normalizeAppPath(key) + } + await writeManifest( path.join(distDir, APP_PATH_ROUTES_MANIFEST), appPathRoutes