Skip to content

fix: add a fallback for loadManifest import path #2881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 30, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/run/handlers/cache.cts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,15 @@ export class NetlifyCacheHandler implements CacheHandlerForMultipleVersions {
typeof cacheControl !== 'undefined')
) {
try {
const { loadManifest } = await import('next/dist/server/load-manifest.js')
let loadManifest
try {
// @ts-expect-error Starting in 15.4.0-canary.10 loadManifest was relocated (https://github.com/vercel/next.js/pull/78358)
// eslint-disable-next-line @typescript-eslint/no-extra-semi, n/no-missing-import, import/no-unresolved
;({ loadManifest } = await import('next/dist/server/load-manifest.external.js'))
} catch {
// eslint-disable-next-line @typescript-eslint/no-extra-semi
;({ loadManifest } = await import('next/dist/server/load-manifest.js'))
}
const prerenderManifest = loadManifest(
join(this.options.serverDistDir, '..', 'prerender-manifest.json'),
) as PrerenderManifest
Expand Down
Loading