Skip to content

miniflare: sourcemap references sources outside its package boundary #13555

@StephenTangCook

Description

@StephenTangCook

Problem

miniflare's bundled dist/src/index.js.map contains sources entries that point to files outside the miniflare package directory — specifically into its nested node_modules dependencies (zod, capnp-es, acorn, chokidar, puppeteer/browsers, etc.).

In pnpm-based monorepos, these paths don't resolve because pnpm hoists dependencies to different locations than the paths baked into the sourcemap.

This produces dozens of warnings at runtime:

Sourcemap for ".../node_modules/miniflare/dist/src/index.js" points to a source file outside its package: ".../miniflare/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js"
Sourcemap for ".../node_modules/miniflare/dist/src/index.js" points to a source file outside its package: ".../miniflare/node_modules/.pnpm/capnp-es@0.0.14_typescript@5.8.3/node_modules/capnp-es/dist/index.mjs"
Sourcemap for ".../node_modules/miniflare/dist/src/index.js" points to a source file outside its package: ".../miniflare/node_modules/.pnpm/chokidar@4.0.1/node_modules/chokidar/src/index.ts"
Sourcemap for ".../node_modules/miniflare/dist/src/index.js" points to a source file outside its package: ".../miniflare/node_modules/.pnpm/@puppeteer+browsers@2.10.6/node_modules/@puppeteer/browsers/src/launch.ts"
... (30+ similar warnings)

Expected behavior

Either:

  1. Embed sources inline via sourcesContent so external paths aren't needed, or
  2. Use relative paths that stay within the package boundary, or
  3. Exclude external dependency sources from the sourcemap

Environment

  • miniflare@4.20260409.0
  • pnpm@10.x monorepo
  • @cloudflare/vitest-pool-workers@0.14.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions