Skip to content

pnpm generate:importmap fails with workspace private package #15609

@italodr

Description

@italodr

Describe the Bug

After upgrading from 3.73.0 to 3.74.0 or higher, the command pnpm generate:importmap and pnpm migrate:create fails with an ESM export error.
An error similar to the following occurs. The exported name mentioned exists, but for some reason it fails starting with version 3.74.0.
The same setup works correctly in 3.73.0.

import { someFunction } from 'utilities'
         ^
SyntaxError: The requested module 'utilities' does not provide an export named 'someFunction'
    at #asyncInstantiate (node:internal/modules/esm/module_job:302:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:405:5)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:660:26)
    at async runBinScript (.../node_modules/payload/dist/bin/index.js:86:27)
    at async bin (.../node_modules/payload/dist/bin/index.js:44:29)
    at async start (file:///.../node_modules/payload/bin.js:30:7)

Node.js v24.13.0

Link to the code that reproduces this issue

https://github.com/italodr/payloadcms-turborepo-test

Reproduction Steps

Unfortunately, the exact reproduction requires a private npm package, which I cannot share.

However, the setup is:

  1. Monorepo with pnpm workspaces.
  2. A private npm package (utilities) used inside the Payload app. "@private/icons"
  3. Payload config imports named exports from that package. (line 1 payload.config.ts)

Initialize the project:

  1. Change "packages/utilities/package.json" dependecy with your private package
  2. Change the export of the package in "packages/utilities/src/index.ts"
  3. Update the imports and usage in "examples/with-payload/src/payload.config.ts"
  4. Run the following commands from the root:
pnpm install
pnpm build:packages

Inside "examples/with-payload" run:

pnpm dev

→ Works correctly.

Then:

pnpm generate:importmap

# or

pnpm migrate:create

→ Fails.

Which area(s) are affected?

area: core

Environment Info

Binaries:
  Node: 24.13.0
  npm: 11.6.2
  Yarn: 1.22.22
  pnpm: 10.4.1
Relevant Packages:
  payload: 3.76.1
  next: 16.1.6
  @payloadcms/db-sqlite: 3.76.1
  @payloadcms/drizzle: 3.76.1
  @payloadcms/graphql: 3.76.1
  @payloadcms/next/utilities: 3.76.1
  @payloadcms/richtext-lexical: 3.76.1
  @payloadcms/translations: 3.76.1
  @payloadcms/ui/shared: 3.76.1
  react: 19.2.1
  react-dom: 19.2.1
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Wed Oct 15 21:12:05 PDT 2025; root:xnu-11417.140.69.703.14~1/RELEASE_ARM64_T6030
  Available memory (MB): 18432
  Available CPU cores: 11

Metadata

Metadata

Assignees

Labels

Bugarea: coreCore Payload functionality

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions