nextjs - ✅(Solved) Fix Build failing after 16.1.2 to 16.2 upgrade [1 pull requests, 6 comments, 6 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#91642Fetched 2026-04-08 01:01:24
View on GitHub
Comments
6
Participants
6
Timeline
22
Reactions
0
Author
Timeline (top)
commented ×6labeled ×5referenced ×4unlabeled ×2

Error Message

GET / 500 in 32ms (next.js: 19ms, application-code: 13ms) [browser] Uncaught Error: ./node_modules/fflate/lib/node.cjs:22:13 Module not found: Can't resolve <dynamic> 20 | node_worker_1["default"] = Worker ? function (c, _, msg, transfer, cb) { 21 | var done = false;

22 | var w = new Worker(c + workerAdd, { eval: true }) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 23 | .on('error', function (e) { return cb(e, null); }) 24 | .on('message', function (m) { return cb(null, m); }) 25 | .on('exit', function (c) {

Import trace: Server Component: ./node_modules/fflate/lib/node.cjs ./node_modules/jspdf/dist/jspdf.node.min.js ./app/create-pdf-action.ts ./app/page.tsx

https://nextjs.org/docs/messages/module-not-found

at <unknown> (Error: ./node_modules/fflate/lib/node.cjs:22:13)
at <unknown> (https://nextjs.org/docs/messages/module-not-found)
at <unknown> (https://nextjs.org/docs/messages/module-not-found)

[browser] ./node_modules/fflate/lib/node.cjs:22:13 Module not found: Can't resolve <dynamic> 20 | node_worker_1["default"] = Worker ? function (c, _, msg, transfer, cb) { 21 | var done = false;

22 | var w = new Worker(c + workerAdd, { eval: true }) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 23 | .on('error', function (e) { return cb(e, null); }) 24 | .on('message', function (m) { return cb(null, m); }) 25 | .on('exit', function (c) {

Import trace: Server Component: ./node_modules/fflate/lib/node.cjs ./node_modules/jspdf/dist/jspdf.node.min.js ./app/create-pdf-action.ts ./app/page.tsx

https://nextjs.org/docs/messages/module-not-found at console.overrideMethod [as error] (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/installHook.js:1:174822) (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/installHook.js:1:174822) [browser] ./node_modules/fflate/lib/node.cjs:22:13 Module not found: Can't resolve <dynamic> 20 | node_worker_1["default"] = Worker ? function (c, _, msg, transfer, cb) { 21 | var done = false;

22 | var w = new Worker(c + workerAdd, { eval: true }) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 23 | .on('error', function (e) { return cb(e, null); }) 24 | .on('message', function (m) { return cb(null, m); }) 25 | .on('exit', function (c) {

Import trace: Server Component: ./node_modules/fflate/lib/node.cjs ./node_modules/jspdf/dist/jspdf.node.min.js ./app/create-pdf-action.ts ./app/page.tsx

https://nextjs.org/docs/messages/module-not-found at console.overrideMethod [as error] (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/installHook.js:1:174822) (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/installHook.js:1:174822)

Fix Action

Fixed

PR fix notes

PR #91666: [turbopack] Respect {eval:true} in worker_threads constructors

Description (problem / solution / changelog)

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

Changed files

  • test/e2e/app-dir/node-worker-threads/app/api/jspdf-test/route.ts (added, +20/-0)
  • test/e2e/app-dir/node-worker-threads/node-worker-threads.test.ts (modified, +12/-0)
  • turbopack/crates/turbopack-core/src/resolve/parse.rs (modified, +6/-1)
  • turbopack/crates/turbopack-ecmascript/src/references/mod.rs (modified, +53/-1)

Code Example

GET / 500 in 32ms (next.js: 19ms, application-code: 13ms)
[browser] Uncaught Error: ./node_modules/fflate/lib/node.cjs:22:13
Module not found: Can't resolve <dynamic>
  20 | node_worker_1["default"] = Worker ? function (c, _, msg, transfer, cb) {
  21 |     var done = false;
> 22 |     var w = new Worker(c + workerAdd, { eval: true })
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  23 |         .on('error', function (e) { return cb(e, null); })
  24 |         .on('message', function (m) { return cb(null, m); })
  25 |         .on('exit', function (c) {



Import trace:
  Server Component:
    ./node_modules/fflate/lib/node.cjs
    ./node_modules/jspdf/dist/jspdf.node.min.js
    ./app/create-pdf-action.ts
    ./app/page.tsx

https://nextjs.org/docs/messages/module-not-found


    at <unknown> (Error: ./node_modules/fflate/lib/node.cjs:22:13)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
[browser] ./node_modules/fflate/lib/node.cjs:22:13
Module not found: Can't resolve <dynamic>
  20 | node_worker_1["default"] = Worker ? function (c, _, msg, transfer, cb) {
  21 |     var done = false;
> 22 |     var w = new Worker(c + workerAdd, { eval: true })
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  23 |         .on('error', function (e) { return cb(e, null); })
  24 |         .on('message', function (m) { return cb(null, m); })
  25 |         .on('exit', function (c) {

Import trace:
  Server Component:
    ./node_modules/fflate/lib/node.cjs
    ./node_modules/jspdf/dist/jspdf.node.min.js
    ./app/create-pdf-action.ts
    ./app/page.tsx

https://nextjs.org/docs/messages/module-not-found 
    at console.overrideMethod [as error] (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/installHook.js:1:174822) (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/installHook.js:1:174822)
[browser] ./node_modules/fflate/lib/node.cjs:22:13
Module not found: Can't resolve <dynamic>
  20 | node_worker_1["default"] = Worker ? function (c, _, msg, transfer, cb) {
  21 |     var done = false;
> 22 |     var w = new Worker(c + workerAdd, { eval: true })
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  23 |         .on('error', function (e) { return cb(e, null); })
  24 |         .on('message', function (m) { return cb(null, m); })
  25 |         .on('exit', function (c) {

Import trace:
  Server Component:
    ./node_modules/fflate/lib/node.cjs
    ./node_modules/jspdf/dist/jspdf.node.min.js
    ./app/create-pdf-action.ts
    ./app/page.tsx

https://nextjs.org/docs/messages/module-not-found 
    at console.overrideMethod [as error] (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/installHook.js:1:174822) (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/installHook.js:1:174822)

---

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:56:42 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T8142
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 22.21.1
  npm: 11.6.4
  Yarn: 1.22.22
  pnpm: 10.26.0
Relevant Packages:
  next: 16.2.0 // Latest available version is detected (16.2.0).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/yukosgiti/next-js-16-2-0-bug

To Reproduce

The reproduction has 2 commits. 1st commit - pdfjs working normally in a server action. 2nd commit - ran npx next upgrade

  • checkout the 1st commi
  • npm install
  • npm run dev
  • click on button at /
  • pdf created.
  • then run: npx next upgrade
  • the dev server errors

Current vs. Expected behavior

the website should work as it did before the upgrade

The build and the dev server gives the following error:

GET / 500 in 32ms (next.js: 19ms, application-code: 13ms)
[browser] Uncaught Error: ./node_modules/fflate/lib/node.cjs:22:13
Module not found: Can't resolve <dynamic>
  20 | node_worker_1["default"] = Worker ? function (c, _, msg, transfer, cb) {
  21 |     var done = false;
> 22 |     var w = new Worker(c + workerAdd, { eval: true })
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  23 |         .on('error', function (e) { return cb(e, null); })
  24 |         .on('message', function (m) { return cb(null, m); })
  25 |         .on('exit', function (c) {



Import trace:
  Server Component:
    ./node_modules/fflate/lib/node.cjs
    ./node_modules/jspdf/dist/jspdf.node.min.js
    ./app/create-pdf-action.ts
    ./app/page.tsx

https://nextjs.org/docs/messages/module-not-found


    at <unknown> (Error: ./node_modules/fflate/lib/node.cjs:22:13)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)
[browser] ./node_modules/fflate/lib/node.cjs:22:13
Module not found: Can't resolve <dynamic>
  20 | node_worker_1["default"] = Worker ? function (c, _, msg, transfer, cb) {
  21 |     var done = false;
> 22 |     var w = new Worker(c + workerAdd, { eval: true })
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  23 |         .on('error', function (e) { return cb(e, null); })
  24 |         .on('message', function (m) { return cb(null, m); })
  25 |         .on('exit', function (c) {

Import trace:
  Server Component:
    ./node_modules/fflate/lib/node.cjs
    ./node_modules/jspdf/dist/jspdf.node.min.js
    ./app/create-pdf-action.ts
    ./app/page.tsx

https://nextjs.org/docs/messages/module-not-found 
    at console.overrideMethod [as error] (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/installHook.js:1:174822) (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/installHook.js:1:174822)
[browser] ./node_modules/fflate/lib/node.cjs:22:13
Module not found: Can't resolve <dynamic>
  20 | node_worker_1["default"] = Worker ? function (c, _, msg, transfer, cb) {
  21 |     var done = false;
> 22 |     var w = new Worker(c + workerAdd, { eval: true })
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  23 |         .on('error', function (e) { return cb(e, null); })
  24 |         .on('message', function (m) { return cb(null, m); })
  25 |         .on('exit', function (c) {

Import trace:
  Server Component:
    ./node_modules/fflate/lib/node.cjs
    ./node_modules/jspdf/dist/jspdf.node.min.js
    ./app/create-pdf-action.ts
    ./app/page.tsx

https://nextjs.org/docs/messages/module-not-found 
    at console.overrideMethod [as error] (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/installHook.js:1:174822) (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/installHook.js:1:174822)

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:56:42 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T8142
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 22.21.1
  npm: 11.6.4
  Yarn: 1.22.22
  pnpm: 10.26.0
Relevant Packages:
  next: 16.2.0 // Latest available version is detected (16.2.0).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

React, Server Actions

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local)

Additional context

It might be an issue with react as well.

extent analysis

Fix Plan

The issue seems to be related to the fflate library and its usage of Web Workers. To fix this, we can try to use a different version of fflate or disable the use of Web Workers.

Here are the steps to fix the issue:

  • Update jspdf to the latest version: npm install jspdf@latest
  • If the issue persists, try to disable the use of Web Workers in fflate by using the browser version of fflate instead of the node version.
  • Add the following code to your next.config.js file to disable the use of Web Workers:
module.exports = {
  //... other configurations ...
  webpack: (config) => {
    config.resolve = {
      ...config.resolve,
      alias: {
        ...config.resolve.alias,
        fflate: 'fflate/browser',
      },
    };
    return config;
  },
};

Alternatively, you can also try to use a different library for creating PDFs, such as pdfkit.

Verification

To verify that the fix worked, run npm run dev and check if the error is resolved. You can also try to create a PDF using the create-pdf-action and see if it works as expected.

Extra Tips

  • Make sure to check the documentation of fflate and jspdf for any updates or changes that may affect the usage of Web Workers.
  • If you are using a different library for creating PDFs, make sure to check its documentation for any specific configurations or settings that may be required.
  • If the issue persists, try to debug the code and see where the error is coming from. You can use the browser's developer tools or a debugger like node --inspect to debug the code.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - ✅(Solved) Fix Build failing after 16.1.2 to 16.2 upgrade [1 pull requests, 6 comments, 6 participants]