Skip to content

fix: resolve ESM-only package exports maps (fixes #1311) - #1344

Draft
QuarkOS wants to merge 1 commit into
vercel:mainfrom
QuarkOS:cursor/fix-esm-import-only-exports-7a6f
Draft

fix: resolve ESM-only package exports maps (fixes #1311)#1344
QuarkOS wants to merge 1 commit into
vercel:mainfrom
QuarkOS:cursor/fix-esm-import-only-exports-7a6f

Conversation

@QuarkOS

@QuarkOS QuarkOS commented Aug 30, 2026

Copy link
Copy Markdown

Fixes #1311.

Problem

ncc failed to compile packages whose package.json exports map has import/types but no default/require (for example @actions/core 3.x / @github/core).

Error: Package path . is not exported
Did you mean './@actions/core'?

Webpack CJS resolution only allowed require, node, and production/development. ESM-only packages never matched, including when the build itself was ESM and a CJS file in the graph used require().

Direct import of those packages already worked on current main. The failure is CJS-style resolution of an import-only exports map.

Change

Add import to CJS conditionNames. require stays first so dual packages still prefer their CJS entry when that condition is listed first.

Test

New test/unit/exports-import-only fixture: ESM project (type: module) that loads a CJS wrapper which require()s a package with only types + import exports.

node --expose-gc --max_old_space_size=4096 node_modules/jest/bin/jest.js --globals '{"coverage":true}' test/unit.test.js -t 'exports-import-only'

Packages whose exports map has only `import`/`types` (no `require` or
`default`), such as @actions/core 3.x, failed with "Package path . is
not exported" when webpack resolved them as CommonJS.

Include `import` in CJS conditionNames so those packages can be bundled.
`require` stays first so dual packages still prefer their CJS entry when
it is listed first.

Fixes vercel#1311

Co-authored-by: Emilio Schwaiger <QuarkOS@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

github/core package fails build because of exports map

2 participants