Unverified Commit ee76e305 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

dx: Include path count in export error message (#89333)

Supersedes https://github.com/vercel/next.js/pull/88910

---
<a
href="https://cursor.com/background-agent?bcId=bc-a05c69b9-7049-4095-8985-761868c63e1c"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/agents?id=bc-a05c69b9-7049-4095-8985-761868c63e1c"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>

---------
Co-authored-by: 's avatarCursor Agent <cursoragent@cursor.com>
Co-authored-by: 's avatarSebastian "Sebbie" Silbermann <sebastian.silbermann@vercel.com>
parent 9662feb6
...@@ -1050,5 +1050,6 @@ ...@@ -1050,5 +1050,6 @@
"1049": "Turbopack is not supported on this platform (%s/%s) because native bindings are not available. Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.\\n\\nTo use Next.js on this platform, use Webpack instead:\\n next dev --webpack\\n\\nFor more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms", "1049": "Turbopack is not supported on this platform (%s/%s) because native bindings are not available. Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.\\n\\nTo use Next.js on this platform, use Webpack instead:\\n next dev --webpack\\n\\nFor more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms",
"1050": "Turbopack is not supported on this platform (%s/%s) because native bindings are not available. Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.\\n\\nTo build on this platform, use Webpack instead:\\n next build --webpack\\n\\nFor more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms", "1050": "Turbopack is not supported on this platform (%s/%s) because native bindings are not available. Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.\\n\\nTo build on this platform, use Webpack instead:\\n next build --webpack\\n\\nFor more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms",
"1051": "Turbopack trace server is not supported on this platform (%s/%s) because native bindings are not available. Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.", "1051": "Turbopack trace server is not supported on this platform (%s/%s) because native bindings are not available. Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings.",
"1052": "Turbopack is not supported on this platform (%s/%s) because native bindings are not available. Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings. Use the --webpack flag instead." "1052": "Turbopack is not supported on this platform (%s/%s) because native bindings are not available. Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings. Use the --webpack flag instead.",
"1053": "Export encountered errors on %s %s:\\n\\t%s"
} }
...@@ -997,7 +997,7 @@ async function exportAppImpl( ...@@ -997,7 +997,7 @@ async function exportAppImpl(
if (failedExportAttemptsByPage.size > 0) { if (failedExportAttemptsByPage.size > 0) {
const failedPages = Array.from(failedExportAttemptsByPage.keys()) const failedPages = Array.from(failedExportAttemptsByPage.keys())
throw new ExportError( throw new ExportError(
`Export encountered errors on following paths:\n\t${failedPages `Export encountered errors on ${failedPages.length} ${failedPages.length === 1 ? 'path' : 'paths'}:\n\t${failedPages
.sort() .sort()
.join('\n\t')}` .join('\n\t')}`
) )
......
...@@ -16,7 +16,7 @@ describe('Handles Errors During Export', () => { ...@@ -16,7 +16,7 @@ describe('Handles Errors During Export', () => {
}) })
expect(stdout + stderr).not.toMatch(/ERR_IPC_CHANNEL_CLOSED/) expect(stdout + stderr).not.toMatch(/ERR_IPC_CHANNEL_CLOSED/)
expect(stderr).toContain('Export encountered errors on following paths') expect(stderr).toMatch(/Export encountered errors on \d+ paths?:/)
expect(stderr).toContain('/page') expect(stderr).toContain('/page')
expect(stderr).toContain('/page-1') expect(stderr).toContain('/page-1')
expect(stderr).toContain('/page-2') expect(stderr).toContain('/page-2')
......
...@@ -20,9 +20,7 @@ describe('app-dir-hide-suppressed-error-during-next-export', () => { ...@@ -20,9 +20,7 @@ describe('app-dir-hide-suppressed-error-during-next-export', () => {
await expect(next.start()).rejects.toThrow('next build failed') await expect(next.start()).rejects.toThrow('next build failed')
expect(next.cliOutput).toInclude('Page build time error') expect(next.cliOutput).toInclude('Page build time error')
expect(next.cliOutput).toInclude('occurred prerendering page "/"') expect(next.cliOutput).toInclude('occurred prerendering page "/"')
expect(next.cliOutput).toInclude( expect(next.cliOutput).toInclude('Export encountered errors on 1 path')
'Export encountered errors on following paths'
)
expect(next.cliOutput).not.toInclude( expect(next.cliOutput).not.toInclude(
'The specific message is omitted in production builds to avoid leaking sensitive details.' 'The specific message is omitted in production builds to avoid leaking sensitive details.'
) )
......
...@@ -216,7 +216,7 @@ describe('build-output-prerender', () => { ...@@ -216,7 +216,7 @@ describe('build-output-prerender', () => {
To debug the issue, start the app in development mode by running \`next dev\`, then open "/server" in your browser to investigate the error. To debug the issue, start the app in development mode by running \`next dev\`, then open "/server" in your browser to investigate the error.
Error occurred prerendering page "/server". Read more: https://nextjs.org/docs/messages/prerender-error Error occurred prerendering page "/server". Read more: https://nextjs.org/docs/messages/prerender-error
> Export encountered errors on following paths: > Export encountered errors on 2 paths:
/client/page: /client /client/page: /client
/server/page: /server" /server/page: /server"
`) `)
...@@ -246,7 +246,7 @@ describe('build-output-prerender', () => { ...@@ -246,7 +246,7 @@ describe('build-output-prerender', () => {
To debug the issue, start the app in development mode by running \`next dev\`, then open "/server" in your browser to investigate the error. To debug the issue, start the app in development mode by running \`next dev\`, then open "/server" in your browser to investigate the error.
Error occurred prerendering page "/server". Read more: https://nextjs.org/docs/messages/prerender-error Error occurred prerendering page "/server". Read more: https://nextjs.org/docs/messages/prerender-error
> Export encountered errors on following paths: > Export encountered errors on 2 paths:
/client/page: /client /client/page: /client
/server/page: /server" /server/page: /server"
`) `)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment