Typescript无法导入json的问题
项目场景:
在使用webpack作为打包工具时需要从项目目录中导入json文件
问题描述
会报错:Cannot find module ‘./assets/test.json’. Did you mean to set the ‘moduleResolution’ option to ‘node’, or to add aliases to the ‘paths’ option?
解决方案:
在custom.d.ts中添加描述
declare module "*.json" {
const co
原创
2022-04-12 16:50:49 ·
1063 阅读 ·
0 评论