Skip to content

Commit

Permalink
Add page name to error logged in Turbopack
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens committed Feb 18, 2024
1 parent 160bb99 commit 12f1329
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1500,10 +1500,14 @@ export default async function build(
currentEntrypoints,
})

const errors = []
for (const pageIssues of currentIssues.values()) {
const errors: {
page: string
message: string
}[] = []
for (const [page, pageIssues] of currentIssues) {
for (const issue of pageIssues.values()) {
errors.push({
page,
message: formatIssue(issue),
})
}
Expand All @@ -1512,7 +1516,9 @@ export default async function build(
if (errors.length > 0) {
throw new Error(
`Turbopack build failed with ${errors.length} issues:\n${errors
.map((e) => e.message)
.map((e) => {
return 'Page: ' + e.page + '\n' + e.message
})
.join('\n')}`
)
}
Expand Down

0 comments on commit 12f1329

Please sign in to comment.