在开发过程中,--watch是一个很好的特性。但是,在我的应用程序中,我将文件上传到一个名为tmp的目录。每当一个文件被上传到这个目录时,我的应用程序就会重新编译,这会导致各种问题。我希望将tmp排除在监视范围之外。
到目前为止,我已经尝试将tmp添加到tsconfig.json的"exclude":属性中,但这没有帮助。
我已经看过文档了,但我找不到任何关于如何做到这一点的信息。https://www.typescriptlang.org/docs/handbook/configuring-watch.html
我想要实现的目标是可能的吗?
发布于 2019-12-06 18:53:35
实际上,我在tsconfig上使用exclude时是这样的:
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"preserveConstEnums": true,
"strict": true,
"target": "es2017",
"baseUrl": ".",
},
"exclude": ["__tests__"]
}当我更改__tests__文件夹中的任何文件时,它将不会在监视模式下再次编译。
注意:我使用的是最新的tsc
发布于 2019-12-06 23:39:50
根据微软的说法,我试图实现的目标是不可能实现的。tsc -w should not recompile if a file is created into an excluded folder
https://stackoverflow.com/questions/59211211
复制相似问题