在我的例子中,我使用的是outDir选项,但不从输入中排除目标目录:
// Bad
{
"compileOnSave": true,
"compilerOptions": {
"outDir": "./dist",
"allowJs": true,
"target": "es5",
"allowUnreachableCode": false,
"noImplicitReturns": true,
"noImplicitAny": true,
"typeRoots": [ "./typings" ],
"outFile": "./dist/combined.js"
},
"include": [
"./**/*"
],
"exclude": [
"./plugins/**/*",
"./typings/**/*"
]
}
我们所要做的就是排除以下文件outDir:
// Good
{
"compileOnSave": true,
"compilerOptions": {
"outDir": "./dist",
"allowJs": true,
"target": "es5",
"allowUnreachableCode": false,
"noImplicitReturns": true,
"noImplicitAny": true,
"typeRoots": [ "./typings" ],
"outFile": "./dist/combined.js"
},
"include": [
"./**/*"
],
"exclude": [
"./plugins/**/*",
"./typings/**/*",
"./dist/**/*" // This is what fixed it!
]
}