我有一个ASP。NET核心项目,我得到这个错误时,我试图构建它:

error TS18003: Build:No inputs were found in config file 'Z:/Projects/client/ZV/src/ZV/Scripts/tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["../wwwroot/app","node_modules/*"]'.
1>         The command exited with code 1.
1>       Done executing task "VsTsc" -- FAILED.

这是我的tsconfig。json文件:

{
  "compileOnSave": true,
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [ "es5", "dom" ],
    "module": "commonjs",
    "moduleResolution": "node",
    "noEmitOnError": true,
    "noImplicitAny": false,
    "outDir": "../wwwroot/app/",
    "removeComments": false,
    "sourceMap": true,
    "target": "es6"
  },
  "exclude": [
    "../wwwroot/app",
    "node_modules/*"
  ]
}

这是bug还是我做错了什么?我最近把Visual Studio 2015升级到3。有人以前遇到过这种情况吗?


当前回答

在现代的typescript配置中,只需要设置"allowJs",而不需要在include目录中添加任何空的.ts文件,例如"src"(在include array中指定)

tsconfig.json

{
  "compilerOptions": {
    "allowJs": true,
   ...
  },
  "include": [
    "src"
  ]
}

其他回答

我有一个tsconfig。Json文件,不适用于任何.ts文件。在一个单独的文件夹里。相反,我只使用它作为通过“extends”:“../Configs/tsconfig.json”的其他tsconfig文件的基础。只要我重命名基本配置文件,以其他如base-tsconfig。Json(并更新了extends语句)错误消失了,扩展仍然工作。

你需要有根索引。TSX或指数。Ts文件使TSC命令工作。

将一个空的typescript文件添加到typescript scripts文件夹(tsconfig文件的位置),以满足typescript编译器的要求。

我必须将文件项添加到tsconfig中。Json文件,如下所示:

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "sourceMap": true,
    },
    "files": [
        "../MyFile.ts"
    ] 
}

更多详情请访问:https://www.typescriptlang.org/docs/handbook/tsconfig-json.html

我用了这个 如何在。net核心项目中禁用TypeScript编译?

因为我使用模板,而那些包只需要我的模板。 然而,我可以在它们的node_module文件中看到每个包的导出。 如果你有同样的情况,你可以使用上面的链接