【发布时间】:2021-12-25 03:53:40
【问题描述】:
我遇到了node-fetch 库的问题。
新版本 (3.0.3) 在其 package.json 中有 "type": "module"。这是一个问题,因为我将代码从 ES6 转换为使用 require 的常规 js,然后我得到 ...firebase_datasource.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
我可以使用早期版本的node-fetch,它的package.json 中的package.json 中不包含"type": "module",但这不是解决方案。
处理这个问题的正确方法是什么?
【问题讨论】:
标签: ecmascript-6 transpiler node-fetch