typescript 模块引用错误,配置 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,