我是打字稿的新手,当我编译代码时,它编译正确,但是当我使用节点运行程序时,我收到此错误 ReferenceError: Exports is not Defined in ES modulescope
ReferenceError: exports is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and 'D:\projects\pro8\package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///D:/projects/pro8/await.js:40:1
at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
at async loadESM (node:internal/process/esm_loader:88:5)
at async handleMainPromise (node:internal/modules/run_main:65:12)
Run Code Online (Sandbox Code Playgroud)
打字稿代码
import fetch from …Run Code Online (Sandbox Code Playgroud)