[Bug]: failure of import of ESM package when called from CJS project - #16329
Open
tsushanth wants to merge 1 commit into
Open
[Bug]: failure of import of ESM package when called from CJS project#16329tsushanth wants to merge 1 commit into
tsushanth wants to merge 1 commit into
Conversation
✅ Deploy Preview for jestjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
babel-jest
babel-plugin-jest-hoist
babel-preset-jest
create-jest
@jest/diff-sequences
expect
@jest/expect-utils
jest
jest-changed-files
jest-circus
jest-cli
jest-config
@jest/console
@jest/core
@jest/create-cache-key-function
jest-diff
jest-docblock
jest-each
@jest/environment
jest-environment-jsdom
@jest/environment-jsdom-abstract
jest-environment-node
@jest/expect
@jest/fake-timers
@jest/get-type
@jest/globals
jest-haste-map
jest-jasmine2
jest-leak-detector
jest-matcher-utils
jest-message-util
jest-mock
@jest/pattern
jest-phabricator
jest-regex-util
@jest/reporters
jest-resolve
jest-resolve-dependencies
jest-runner
jest-runtime
@jest/schemas
jest-snapshot
@jest/snapshot-utils
@jest/source-map
@jest/test-result
@jest/test-sequencer
@jest/transform
@jest/types
jest-util
jest-validate
jest-watcher
jest-worker
pretty-format
commit: |
tsushanth
force-pushed
the
fix/-Bug-failure-of-import-of-ESM-package-wh-1786295231
branch
from
August 13, 2026 08:24
ee774fe to
76c80fb
Compare
|
Contributor
Author
|
recheck |
SimenB
requested changes
Aug 14, 2026
SimenB
left a comment
Member
There was a problem hiding this comment.
I don't think this is right - the only shape this catch triggers for is one Node itself rejects. resolveCjs throws when "exports" has an "import" branch and no require/default/module-sync, and require() of such a package in plain Node gives:
ERR_PACKAGE_PATH_NOT_EXPORTED No "exports" main defined in .../node_modules/esm-only-pkg/package.json
With this patch Jest loads it. Tests passing where production throws is the wrong direction for a test runner.
This made me realise we're missing module-sync condition tho - I'll add that 🙂
tsushanth
force-pushed
the
fix/-Bug-failure-of-import-of-ESM-package-wh-1786295231
branch
3 times, most recently
from
August 17, 2026 15:41
03fb541 to
ede7ed7
Compare
tsushanth
force-pushed
the
fix/-Bug-failure-of-import-of-ESM-package-wh-1786295231
branch
from
August 18, 2026 06:02
ede7ed7 to
61f04d9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
in
CjsLoader.requireModule, catchresolveCjsfailures and retry withresolveEsmwhensupportsSyncEvaluateis true, allowingrequire()of ESM-only packages (with only"import"export condition) to work on Node 24.9+Found via automated repo scanning, fix written and reviewed before opening.