Skip to content

[turbopack] print Turbopack warnings after SSG#95430

Open
sampoder wants to merge 1 commit into
canaryfrom
sp/defer-turbopack-warnings
Open

[turbopack] print Turbopack warnings after SSG#95430
sampoder wants to merge 1 commit into
canaryfrom
sp/defer-turbopack-warnings

Conversation

@sampoder

@sampoder sampoder commented Jul 2, 2026 •

Copy link
Copy Markdown
Member

Picked up this from "Turbopack Work Ideas 2026":

  1. (S) Turbopack Warnings are before SSG Errors
    • Solution: print Turbopack warnings after SSG

I think this is a pretty bare-bones fix for this - let me know if the idea was to do something different!

See an example output:

✓ Running next.config.js took 6ms
▲ Next.js 16.3.0-canary.75 (Turbopack)

  Creating an optimized production build ...
✓ Compiled successfully in 889ms
  Running TypeScript ...
  Finished TypeScript in 38ms ...
  Collecting page data using 5 workers ...
  Generating static pages using 5 workers (0/4) ...
Error occurred prerendering page "/boom". Read more: https://nextjs.org/docs/messages/prerender-error
Error: boom during prerender
    at <unknown> (app/boom/page.js:2:9)
  1 | export default function Page() {
> 2 |   throw new Error("boom during prerender")
    |         ^
  3 | }
  4 | {
  digest: '1942497547'
}
Export encountered an error on /boom/page: /boom, exiting the build.
⨯ Next.js build worker exited with code: 1 and signal: null
Turbopack build encountered 1 warning:
./app/join-cwd.js:4:10
Warning: Dynamic filesystem access causes tracing of the whole project
  �[90m2 |�[0m
  �[90m3 |�[0m �[36mexport�[0m �[36mdefault�[0m �[36mfunction�[0m (f) {
�[33m�[1m>�[0m �[90m4 |�[0m   �[36mreturn�[0m path.join(process.cwd(), f)
  �[90m  |�[0m          �[33m�[1m^^^^^^^^^^^^^^^^^^^^^^^^^^^�[0m
  �[90m5 |�[0m }
  �[90m6 |�[0m

Static analysis determined that this filesystem access causes the whole project to be traced and included in the output.
This is usually unintentional and leads to all source files (including the public folder) to be deployed as part of the server code.
This can slow down deployments or lead to failures when size limits are exceeded.
To resolve this, you can
- make sure they are statically scoped to some subfolder: path.join(process.cwd(), 'data', bar), or
- only use them in development, or
- add ignore comments: path.join(/*turbopackIgnore: true*/ process.cwd(), bar), or
- remove them.

Import trace:
  Server Component:
    ./app/join-cwd.js
    ./app/page.js

@github-actions

github-actions Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Tests Passed

Commit: 64664ea

@github-actions

github-actions Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Stats cancelled

Commit: 64664ea
View workflow run

deferredTurbopackWarnings = undefined
}

// A failing static generation worker exits the process directly (`prerenderEarlyExit`), skipping the flush points below.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deferred Turbopack warnings are truncated/dropped when flushed via console.warn inside the process.once('exit') handler during a prerenderEarlyExit build with piped (non-TTY) stderr.

Fix on Vercel

@lukesandberg lukesandberg requested a review from sokra July 2, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant