Tagged articles
2 articles
Page 1 of 1
DaTaobao Tech
DaTaobao Tech
Aug 16, 2022 · Backend Development

Understanding esModuleInterop: CommonJS vs ES Module in TypeScript

The article explains how toggling TypeScript's esModuleInterop flag changes import behavior between CommonJS and ES Module syntax, causing runtime errors like “TPS is not a constructor,” and offers fixes—either revert the flag and use namespace imports or enable it and use default imports.

CommonJSESModuleNode.js
0 likes · 7 min read
Understanding esModuleInterop: CommonJS vs ES Module in TypeScript