Skip to content

Why does module.importInterop=node disable _interop_require_default #9749

Closed Answered by kdy1
jfirebaugh asked this question in Q&A
Discussion options

You must be logged in to vote

importInterop=node means interop=node for imports, and common js.of node.js does not use __esModule. It's expected by the design of commonjs implementation in nodejs. __esModule is a workaround implemented by tools like babel and swc.

The problem is that the package you are trying to use is compiled using some tool with export interop mode = babel/swc, and it's using the export interop mode of babel/swc. It's not the form of a common js (which is required for importInterop=node) module expected for node.js. It's for babel, swc, tsc, etc... So you are expected to consume it via a tool that supports __esModule.

Replies: 2 comments 14 replies

Comment options

You must be logged in to vote
2 replies
@jfirebaugh
Comment options

@jfirebaugh
Comment options

Comment options

You must be logged in to vote
12 replies
@jfirebaugh
Comment options

@magic-akari
Comment options

@jfirebaugh
Comment options

@kdy1
Comment options

Answer selected by kdy1
@jfirebaugh
Comment options

@kdy1
Comment options

@jfirebaugh
Comment options

@magic-akari
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants