From 69a3af8372220daf76c19486418b09a3913af61d Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Tue, 23 Apr 2024 13:50:15 -0700 Subject: [PATCH 1/3] Ensure edge prerender-manifest is minimal --- packages/next/src/build/index.ts | 5 ++++- test/e2e/app-dir/app/index.test.ts | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts index 585609c7499b3..5b76ae1b1176f 100644 --- a/packages/next/src/build/index.ts +++ b/packages/next/src/build/index.ts @@ -352,7 +352,10 @@ async function writeEdgePartialPrerenderManifest( // Use env vars in JS bundle and inject the actual vars to edge manifest. const edgePartialPrerenderManifest: DeepReadonly> = { - ...manifest, + routes: {}, + dynamicRoutes: {}, + notFoundRoutes: [], + version: manifest.version, preview: { previewModeId: 'process.env.__NEXT_PREVIEW_MODE_ID', previewModeSigningKey: 'process.env.__NEXT_PREVIEW_MODE_SIGNING_KEY', diff --git a/test/e2e/app-dir/app/index.test.ts b/test/e2e/app-dir/app/index.test.ts index 9976271b0054b..3f1d8f0a7baa6 100644 --- a/test/e2e/app-dir/app/index.test.ts +++ b/test/e2e/app-dir/app/index.test.ts @@ -51,6 +51,12 @@ createNextDescribe( ) }) + it('should not have entire prerender-manifest for edge', async () => { + expect( + await next.readFile('.next/server/prerender-manifest.js') + ).not.toContain('initialRevalidate') + }) + if (!process.env.NEXT_EXPERIMENTAL_COMPILE) { it('should have correct size in build output', async () => { expect(next.cliOutput).toMatch( From ee79fb866307cb20be827b26e83c5bf44ca1f2f7 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Tue, 23 Apr 2024 13:55:26 -0700 Subject: [PATCH 2/3] update test path --- test/e2e/app-dir/app/index.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/app-dir/app/index.test.ts b/test/e2e/app-dir/app/index.test.ts index 3f1d8f0a7baa6..8722caeaa4703 100644 --- a/test/e2e/app-dir/app/index.test.ts +++ b/test/e2e/app-dir/app/index.test.ts @@ -53,7 +53,7 @@ createNextDescribe( it('should not have entire prerender-manifest for edge', async () => { expect( - await next.readFile('.next/server/prerender-manifest.js') + await next.readFile('.next/prerender-manifest.js') ).not.toContain('initialRevalidate') }) From ec271824acd50c039ac9b5c895f8ee416f5256fe Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Tue, 23 Apr 2024 14:46:16 -0700 Subject: [PATCH 3/3] update manifest --- test/turbopack-build-tests-manifest.json | 1 + 1 file changed, 1 insertion(+) diff --git a/test/turbopack-build-tests-manifest.json b/test/turbopack-build-tests-manifest.json index 6d0bb47e37d7e..327e90af29f56 100644 --- a/test/turbopack-build-tests-manifest.json +++ b/test/turbopack-build-tests-manifest.json @@ -1105,6 +1105,7 @@ "app dir - basic should not apply client router filter on shallow", "app dir - basic should not create new root layout when nested (optional)", "app dir - basic should not have loader generated function for edge runtime", + "app dir - basic should not have entire prerender-manifest for edge", "app dir - basic should not include parent when not in parent directory", "app dir - basic should not rerender layout when navigating between routes in the same layout", "app dir - basic should not serve when layout is provided but no folder index",