【发布时间】:2018-10-01 21:05:41
【问题描述】:
我有一个 file.ts 文件,它不包含组件/服务/等,而只是一个数据类型。
当我尝试编译我的程序时,我得到了这个错误:模块构建 失败:错误:TypeScript 中缺少我的 path\File.ts 汇编。请通过“文件”确保它在您的 tsconfig 中 或“包含”属性。
然后我更改了我的 tsconfig.app.json 文件以包含包含标签:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": []
},
"include": [
"**/*.ts"
],
"exclude": [
"**/*.spec.ts"
]
}
按照消息的建议,但我收到了这个错误:
错误 TS18003:在配置文件“tsconfig.json”中找不到输入。 指定的“包含”路径是“[“src/**/*.ts”]”和“排除”路径 是 '["**/*.spec.ts"]'。
我做错了什么?
【问题讨论】:
-
将至少一个 ts 文件添加到您的应用文件夹以解决该错误
-
我的app文件夹里已经有一些文件了:app.component.ts, app.component.css, app.component.html, app.component.spec.ts, app.module.ts
-
确实尝试包括删除 .ts
-
是的,没有帮助。
-
“包括”:[“src/**/*”]