typescript 模塊引用錯(cuò)誤,配置 ts ,添加 esModuleInterop 與 allowSyntheticDefaultImports 這樣,之前的
import * as module from "module"
的模式全部改回為
import module from "module"
error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.
tsconfig.json
"esModuleInterop": true, // <-- ADD THIS LINE
"allowSyntheticDefaultImports": true,