如何解决为什么 Typescript 结果:找不到模块 './config/config.json' 或其相应的类型声明
我的json配置文件路径是
myapp-[config/config.json,src,outdir,....,tsconfig.json]
我在 import configfrom from './config/config.json';
上使用:index.ts
。
{
"compilerOptions": {
"module": "commonjs","allowJs": true,"esModuleInterop": true,"experimentalDecorators": true,"emitDecoratorMetadata": true,"target": "es6","noImplicitAny": false,"moduleResolution": "node","sourceMap": true,"resolveJsonModule": true,"outDir": "app","baseUrl": "./","paths": {
"*": [
"node_modules/*"
]
}
},"exclude": [
"config"
],"include": [
"src/**/*"
]
}
但是,当我编译时,我有一个结果:error TS2307: Cannot find module './config/config.json' or its corresponding type declarations.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。