0

我试图从我的打字稿编译中排除一些文件,因为我的编辑器编写了临时文件,这些文件在进行更改时会导致无关的重新编译。我在我的tsconfig.json

"exclude": ["*flycheck*", "**/*flycheck*"]

tsc --watch用来监视更改和编译。

这有效,直到我像这样添加baseUrl到我的配置中:

"baseUrl": "src",

我正在使用baseUrl,因为我更喜欢绝对导入路径而不是相对路径。

我已经尝试调整排除 glob,但在我的生活中无法让打字稿在baseUrl设置时忽略这些文件。是否有某些原因文件排除不适用于 a baseUrl

4

1 回答 1

0

Do you have an include in your tsconfig.json?

From the docs: https://www.typescriptlang.org/tsconfig#exclude

Exclude - exclude

[...]

It is not a mechanism that prevents a file from being included in the codebase - it simply changes what the include setting finds.

It means that it has no effect if include or files aren't present.

于 2020-11-05T12:20:25.197 回答