Default import from an ESM package into a CommonJS project with esModuleInterop is faulty #58341
Labels
External
Relates to another program, environment, or user action which we cannot control.
🔎 Search Terms
"cjs esm esModuleInterop default", "common esm esModuleInterop default"
🕗 Version & Regression Information
⏯ Playground Link
https://github.com/JonasDoe/typescript-esm-issue
💻 Code
With
esModuleInterop=true
:The transpiled code will be:
🙁 Actual behavior
--experimental-require-module
is supported.esModuleInterop
{"default": {"default": the-imported-object}}
, sothe-imported-object
isn't found🙂 Expected behavior
{"default": the-imported-object}
, so without the double nesting.Additional information about the issue
The original suggestion that this is a bug in TypeScript came from here: panva/node-oidc-provider#1249 (reply in thread), and by a person with greater knowledge about Node and TypeScript. So I'm sorry if I left something unclear.
The text was updated successfully, but these errors were encountered: