Skip to content

Commit 8e06131

Browse files
committed
fix: disable fallback for package payloads
1 parent acdfd3a commit 8e06131

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

nuxt.config.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ export default defineNuxtConfig({
134134
},
135135
// pages
136136
'/package/**': getISRConfig(60, { fallback: 'html' }),
137-
'/package/:name/_payload.json': getISRConfig(60, { fallback: 'json' }),
138-
'/package/:name/v/:version/_payload.json': getISRConfig(60, { fallback: 'json' }),
139-
'/package/:org/:name/_payload.json': getISRConfig(60, { fallback: 'json' }),
140-
'/package/:org/:name/v/:version/_payload.json': getISRConfig(60, { fallback: 'json' }),
137+
'/package/:name/_payload.json': { isr: 60 },
138+
'/package/:name/v/:version/_payload.json': { isr: 60 },
139+
'/package/:org/:name/_payload.json': { isr: 60 },
140+
'/package/:org/:name/v/:version/_payload.json': { isr: 60 },
141141
// infinite cache (versioned - doesn't change)
142142
'/package-code/**': { isr: true, cache: { maxAge: 365 * 24 * 60 * 60 } },
143143
'/package-docs/**': { isr: true, cache: { maxAge: 365 * 24 * 60 * 60 } },
@@ -364,7 +364,6 @@ function getISRConfig(expirationSeconds: number, options: ISRConfigOptions = {})
364364
fallback:
365365
options.fallback === 'html' ? 'spa.prerender-fallback.html' : 'payload-fallback.json',
366366
initialHeaders: options.fallback === 'json' ? { 'content-type': 'application/json' } : {},
367-
initialStatus: options.fallback === 'json' ? 404 : undefined,
368367
} as { expiration: number },
369368
}
370369
}

0 commit comments

Comments
 (0)