Reapply "[turbopack] Add bundling support for worker_threads" (#88725)#88967
Merged
lukesandberg merged 9 commits intocanaryfrom Jan 26, 2026
Merged
Reapply "[turbopack] Add bundling support for worker_threads" (#88725)#88967lukesandberg merged 9 commits intocanaryfrom
lukesandberg merged 9 commits intocanaryfrom
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Collaborator
Tests Passed |
Collaborator
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
|
Merging this PR will not alter performance
Comparing Footnotes
|
66d3002 to
33e3c28
Compare
mmastrac
reviewed
Jan 24, 2026
mischnic
reviewed
Jan 24, 2026
fd92974 to
db18661
Compare
mischnic
approved these changes
Jan 26, 2026
Contributor
Merge activity
|
This reverts commit 1bbba2a.
- Add source field to CodeGenerationIssue to point at the worker instantiation location - Include the resolved module's ident in error messages for non-chunkable and non-evaluatable worker modules - Helps users understand both where the worker was created and which module caused the issue
db18661 to
0a129f3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What?
This PR reapplies #87746 which adds bundling support for Node.js
worker_threadsin Turbopack.Why?
The original PR (#87746) was reverted in #88725 because it broke builds that use packages like
pinowith transports. These packages use dynamic patterns likejoin(__dirname, 'lib', 'worker.js')to resolve worker entry points, which can match non-evaluatable files likepackage.jsonortsconfig.json.How?
This PR reapplies the original changes with the following fixes:
Downgrade errors to warnings in tracing contexts: When
loose_errorsis enabled (tracing mode) orin_tryis true, worker entry point validation errors are now emitted as warnings instead of errors. This follows the established Turbopack pattern used inhandle_resolve_errorand other resolve error handling.Improved error messages: Error messages for non-chunkable and non-evaluatable worker entry point modules now include:
new Worker()call in source code)Added regression test: A new pino-based test case exercises the
thread-streamworker pattern that caused the original failure. This test runs inCodeGenerationAndTracingmode viatest-start-turbo.Changes from original PR
sourcefield toCodeGenerationIssueto support showing issue source locationsget_issue_severity()helper that checksloose_errorsandin_tryto determine severity"SharedbWorker"→"SharedWorker"into_stringimplementationtest/e2e/app-dir/node-worker-threads/Testing
pnpm test-dev-turbo test/e2e/app-dir/node-worker-threads/- all tests passpnpm test-start-turbo test/e2e/app-dir/node-worker-threads/- all tests pass (exercises bundling mode)loose_errorsfix