Angular5 - TypeScript 编译中缺少文件

Angular5 - File is missing from the TypeScript compilation

我有一个 file.ts 文件,它不包含 component/service/etc 而只包含一种数据类型。

When I try to compile my program I get this error: Module build failed: Error: my path\File.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.

然后我更改了 tsconfig.app.json 文件以包含包含标记:

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "es2015",
    "types": []
  },
  "include": [
        "**/*.ts"
    ],
  "exclude": [
    "**/*.spec.ts"
  ]
}

如消息所示,但我收到此错误:

error TS18003: No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["src/**/*.ts"]' and 'exclude' paths were '["**/*.spec.ts"]'.

我做错了什么?

为达到预期效果,请使用正确的路径和文件夹名称,一切正常

POST 中提到的错误是由于路径

其他选项是使用文件

"files": [ 
"file.ts"]

在tsconfig.json

查看此 link 了解更多详情- https://github.com/angular/angular/issues/20091

在我的例子中,我的文件名是 logger.ts 但是在我的规格文件中,我用 import { Logger } from '../contracts/Logger'; 导入了 class 一旦我用适当的区分大小写的方式更正了导入它就起作用了import { Logger } from '../contracts/logger';