问题
I tried using the following in my tsconfig.json file:
...
"declaration": true,
"rootDir": "./src/",
"outDir": "./lib/",
...
The first time I execute tsc
it seems to work fine; but the second time I execute tsc
I get an error where tsc
complains that it cannot write output because it would overwrite an input file.
It seems that tsc
is trying to include the TypeScript declaration files that are written out to my 'lib' directory.
回答1:
Just exclude the files in the lib
folder:
{
"compilerOptions": {
"declaration": true,
"rootDir": "./src/",
"outDir": "./lib/",
}
},
"exclude": [
"node_modules",
"lib"
]
}
来源:https://stackoverflow.com/questions/35800517/how-to-setup-tsconfig-json-to-build-files-in-project-src-and-write-output-to