From f528d9db3ba95d1d42ea389333de941442843179 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Tue, 26 Jan 2021 19:39:26 -0600 Subject: [PATCH] Ensure notFound entries are not added to manifest --- packages/next/build/index.ts | 21 +++++++++++--------- test/integration/i18n-support/test/shared.js | 8 -------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/packages/next/build/index.ts b/packages/next/build/index.ts index 5ac34771d4b9f..0ca466995703f 100644 --- a/packages/next/build/index.ts +++ b/packages/next/build/index.ts @@ -1164,15 +1164,18 @@ export default async function build( // TODO: do we want to show all locale variants in build output for (const locale of i18n.locales) { const localePage = `/${locale}${page === '/' ? '' : page}` - finalPrerenderRoutes[localePage] = { - initialRevalidateSeconds: - exportConfig.initialPageRevalidationMap[localePage], - srcRoute: null, - dataRoute: path.posix.join( - '/_next/data', - buildId, - `${file}.json` - ), + + if (!ssgNotFoundPaths.includes(localePage)) { + finalPrerenderRoutes[localePage] = { + initialRevalidateSeconds: + exportConfig.initialPageRevalidationMap[localePage], + srcRoute: null, + dataRoute: path.posix.join( + '/_next/data', + buildId, + `${file}.json` + ), + } } } } else { diff --git a/test/integration/i18n-support/test/shared.js b/test/integration/i18n-support/test/shared.js index e8bcf53a5e7c1..f4a26d28ef104 100644 --- a/test/integration/i18n-support/test/shared.js +++ b/test/integration/i18n-support/test/shared.js @@ -555,10 +555,6 @@ export function runTests(ctx) { \\"srcRoute\\": \\"/gsp/fallback/[slug]\\", \\"dataRoute\\": \\"/_next/data/BUILD_ID/en/gsp/fallback/always.json\\" }, - \\"/en/not-found\\": { - \\"srcRoute\\": null, - \\"dataRoute\\": \\"/_next/data/BUILD_ID/not-found.json\\" - }, \\"/fr\\": { \\"initialRevalidateSeconds\\": false, \\"srcRoute\\": null, @@ -768,10 +764,6 @@ export function runTests(ctx) { \\"initialRevalidateSeconds\\": false, \\"srcRoute\\": \\"/gsp/fallback/[slug]\\", \\"dataRoute\\": \\"/_next/data/BUILD_ID/nl/gsp/fallback/always.json\\" - }, - \\"/nl/not-found\\": { - \\"srcRoute\\": null, - \\"dataRoute\\": \\"/_next/data/BUILD_ID/not-found.json\\" } }" `)