next.js
3003e17b - [turbopack] Respect `{eval:true}` in worker_threads constructors (#91666)

Commit
7 days ago
[turbopack] Respect `{eval:true}` in worker_threads constructors (#91666) ### What? Fixed Turbopack incorrectly trying to resolve inline JavaScript code as module references when `new Worker()` is called with `{ eval: true }` option. Now we skip creating a reference when `eval:true`, and report warnings if we cannot tell what the value is ### Why? Libraries like jsPDF create Worker threads by passing inline JavaScript code as the first argument along with `{ eval: true }` as the second argument. Turbopack was incorrectly treating this inline code as a file path and attempting to resolve it as a module reference, causing build failures. ### How? Added logic to detect when the `eval: true` option is passed to the Worker constructor. When this option is present, Turbopack now skips creating a worker reference since the first argument contains executable code rather than a file path. Added comprehensive test coverage using jsPDF to verify the fix works correctly. Fixes #91642
Author
Parents
Loading