
解决方案:
在tsconfig.json的compilerOptions添加"allowSyntheticDefaultImports":true

在 TypeScript 项目中,为了解决不能导入默认模块的问题,可以在 tsconfig.json 的 compilerOptions 中设置 allowSyntheticDefaultImports: true。这将允许使用 ES6 的默认导入语法,即使目标模块不导出默认成员。

解决方案:
在tsconfig.json的compilerOptions添加"allowSyntheticDefaultImports":true

5229
3841
1735

被折叠的 条评论
为什么被折叠?