ITADN

[Bug]: Jest 30.4.0 breaks CJS→ESM interop for packages with __esModule: true but no .default (e.g. tslib)

#16142Closedcschramm 创建于 2026-05-08
Needs TriageBug Report
C
cschrammcommented
### Version 30.4.0 ### Steps to reproduce 1. Have a project with "type": "module" and --experimental-vm-modules 2. Depend (directly or transitively) on any package whose ESM build imports from tslib — e.g. @peculiar/asn1-schema, whose import export condition resolves to an ES2015 build containing import { __decorate } from "tslib" 3. Run jest The failure chain: 1. Jest resolves import { __decorate } from "tslib" via the import.node export condition → tslib/modules/index.js 2. modules/index.js does import tslib from '../tslib.js' (a default import of the CJS file) 3. Jest 30.4.0 sees exports.__esModule === true on tslib.js and sets defaultExport = exports.default → undefined 4. const { __extends, ... } = tslib throws TypeError ### Expected behavior Tests pass, as they did with Jest 30.2.0. ### Actual behavior TypeError: Cannot destructure property '__extends' of 'tslib' as it is undefined. at node_modules/tslib/modules/index.js:3:5 ### Additional context _No response_ ### Environment ```shell System: OS: Linux 7.0 Arch Linux CPU: (16) x64 AMD Ryzen 7 7840U w/ Radeon 780M Graphics Binaries: Node: 25.9.0 - /usr/bin/node Yarn: 1.22.22 - /usr/bin/yarn npm: 11.13.0 - /usr/bin/npm ```
关闭于 2026-05-08 1 条评论