From 91c62d6c3eae0b39a69c48d9f28e8b8dfd993714 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 19 Oct 2023 14:32:23 +0100 Subject: [PATCH] fix(nuxt): don't use `prerenderedAt` to override app manifest (#23781) --- packages/nuxt/src/app/composables/payload.ts | 5 +---- test/bundle.test.ts | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/nuxt/src/app/composables/payload.ts b/packages/nuxt/src/app/composables/payload.ts index 7220a36e53..b708f0bcc1 100644 --- a/packages/nuxt/src/app/composables/payload.ts +++ b/packages/nuxt/src/app/composables/payload.ts @@ -79,10 +79,7 @@ async function _importPayload (payloadURL: string) { export async function isPrerendered (url = useRoute().path) { // Note: Alternative for server is checking x-nitro-prerender header const nuxtApp = useNuxtApp() - if (nuxtApp.payload.prerenderedAt) { - return true - } - if (!appManifest) { return false } + if (!appManifest) { return !!nuxtApp.payload.prerenderedAt } const manifest = await getAppManifest() if (manifest.prerendered.includes(url)) { return true diff --git a/test/bundle.test.ts b/test/bundle.test.ts index ed506c5094..0887888846 100644 --- a/test/bundle.test.ts +++ b/test/bundle.test.ts @@ -19,7 +19,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM for (const outputDir of ['.output', '.output-inline']) { it('default client bundle size', async () => { const clientStats = await analyzeSizes('**/*.js', join(rootDir, outputDir, 'public')) - expect.soft(roundToKilobytes(clientStats.totalBytes)).toMatchInlineSnapshot('"99.2k"') + expect.soft(roundToKilobytes(clientStats.totalBytes)).toMatchInlineSnapshot('"99.1k"') expect(clientStats.files.map(f => f.replace(/\..*\.js/, '.js'))).toMatchInlineSnapshot(` [ "_nuxt/entry.js",