Skip to content
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

chore: add extra error info for rsc info helper #54609

Merged
merged 1 commit into from Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/next/src/build/analysis/get-page-static-info.ts
Expand Up @@ -286,8 +286,9 @@ async function tryToReadFile(filePath: string, shouldThrow: boolean) {
return await fs.readFile(filePath, {
encoding: 'utf8',
})
} catch (error) {
} catch (error: any) {
if (shouldThrow) {
error.message = `Next.js ERROR: Failed to read file ${filePath}:\n${error.message}`
throw error
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/next/src/build/index.ts
Expand Up @@ -2865,7 +2865,6 @@ export default async function build(

// If there's /not-found inside app, we prefer it over the pages 404
if (hasStaticApp404) {
// await moveExportedPage('/_error', '/404', '/404', false, 'html')
await moveExportedAppNotFoundTo404()
} else {
// Only move /404 to /404 when there is no custom 404 as in that case we don't know about the 404 page
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/server/lib/find-page-file.ts
Expand Up @@ -91,7 +91,7 @@ export function createValidFileMatcher(
pageExtensions
)}$`
)
const leafOnlyNotFoundFileRegex = new RegExp(
const rootNotFoundFileRegex = new RegExp(
`^not-found\\.${getExtensionRegexString(pageExtensions)}$`
)
/** TODO-METADATA: support other metadata routes
Expand Down Expand Up @@ -136,7 +136,7 @@ export function createValidFileMatcher(
return false
}
const rest = filePath.slice(appDirPath.length + 1)
return leafOnlyNotFoundFileRegex.test(rest)
return rootNotFoundFileRegex.test(rest)
}

return {
Expand Down