使用 TypeScript,我使用 EventEmitter 来监听 node:events 公开的事件。
import EventEmitter from 'events';
const eventEmitter = new EventEmitter();
Exception has occurred: TypeError: events_1.default is not a constructor
这是我的
tsconfig.json
那么,如何才能找到具体原因呢?有经验的请给我正确的答案吗?
提前谢谢您
在
"esModuleInterop": true
文件中添加设置tsconfig.json
,然后一切正常。