Skip to content

Next build logs source-map read errors for existing pnpm workspace dependency maps #2690

Description

@ceolinwill

Link to the code that reproduces this issue

https://github.com/ceolinwill/nextjs-pnpm-sourcemap-error

To Reproduce

  1. Start a new nextjs app using pnpm workspaces
  2. Add the workflow library
  3. Create a workflow using the AI SDK
  4. Run pnpm build

Or:

  1. Clone this repo
  2. Run pnpm build

Current vs. Expected behavior

Current behavior

The build succeeds, but Next logs source-map errors:

ERROR failed to read input source map: failed to find input source map file "index.js.map" in "node_modules/.pnpm/@ai-sdk+provider-utils@5.0.1_zod@4.4.3/node_modules/@ai-sdk/provider-utils/dist/index.js" file as either "node_modules/.pnpm/@ai-sdk+provider-utils@5.0.1_zod@4.4.3/node_modules/@ai-sdk/provider-utils/dist/index.js.map" or with appended .map
    at crates/swc/src/lib.rs:398

ERROR failed to read input source map: failed to find input source map file "index.js.map" in "node_modules/.pnpm/@workflow+serde@4.1.0/node_modules/@workflow/serde/dist/index.js" file as either "node_modules/.pnpm/@workflow+serde@4.1.0/node_modules/@workflow/serde/dist/index.js.map" or with appended .map
    at crates/swc/src/lib.rs:398

The referenced map files do exist:

test -f node_modules/.pnpm/@ai-sdk+provider-utils@5.0.1_zod@4.4.3/node_modules/@ai-sdk/provider-utils/dist/index.js.map
test -f node_modules/.pnpm/@workflow+serde@4.1.0/node_modules/@workflow/serde/dist/index.js.map

Expected behavior

Next should not log source-map read errors when the dependency source map files exist.

Additional context

This reproduces in a pnpm workspace with a Next app under apps/web.

It looks like the source-map path is being resolved relative to the app directory, while pnpm’s virtual store is at the workspace root.

The error appears when workflow/next compiles a workflow step that imports AI SDK packages. A plain Next app importing AI SDK did not reproduce it.

However, I only noticed this issue when I upgraded to the AI SDK v7. It wasn't happening on v6.

Related issues:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions