You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When consuming such modules, transpilers add "unwrap" helpers (like tslib.__importDefault in TypeScript) to detect the __esModule property in exports and use the default property.
In essence, importing mylib from above like this:
// (source es)importfoofrom'mylib';
will produce the following output (roughly) in TypeScript:
Problem
Various transpilers (like TypeScript) put default exports under the
default
property when transpiling ESM to CJS.Meaning:
becomes (roughly):
When consuming such modules, transpilers add "unwrap" helpers (like
tslib.__importDefault
in TypeScript) to detect the__esModule
property inexports
and use thedefault
property.In essence, importing
mylib
from above like this:will produce the following output (roughly) in TypeScript:
This is not the case with pkgroll, it'll consume
mylib
without any helpers or checks during bundling.Please consult the attached repro repository as well as the failing CI showcasing the issue.
Expected behavior
pkgroll uses helpers or detects such cases during bundling to create outputs that handle such cases.
Minimal reproduction URL
https://github.com/enisdenjo/pkgroll-cjs-default-exports-unwrap
Version
v2.5.1
Node.js version
v22.11.0
Package manager
npm
Operating system
macOS
Bugs are expected to be fixed by those affected by it
Compensating engineering work financially will speed up resolution
The text was updated successfully, but these errors were encountered: