ITADN

[Bug]: Jest 30.4.x drops named exports from CJS modules where `module.exports` is a function

#16146Closedpaemuri 创建于 2026-05-08
Needs TriageBug Report
P
paemuricommented
### Version 30.4.1 ### Steps to reproduce 1. Have a project with `"type": "module"` and `--experimental-vm-modules` 2. Depend on a package that sets `module.exports` to a function or class One exemple is `ioredis@v5.10.1`. Just add a test file with the following: ``` import { Redis } from 'ioredis'; ``` ### Expected behavior `import { Redis } from 'ioredis'` should've been resolved correctly. ### Actual behavior ``` SyntaxError: The requested module 'ioredis' does not provide an export named 'Redis' at EsmLoader.tryLoadGraphSync (node_modules/jest-runtime/build/index.js:725:18) ``` ### Additional context It seems similar to https://github.com/jestjs/jest/issues/16144, but sufficiently different for me to open a new issue. If it's deemed as duplicate, please, let me know. Reproduction: https://github.com/paemuri/jest-ioredis-repro ### Environment ```shell System: OS: macOS 26.4.1 CPU: (10) arm64 Apple M1 Pro Binaries: Node: 24.15.0 npm: 11.14.0 ```
关闭于 2026-05-09 0 条评论