0

I am trying to exclude some files from my typescript compilation because my editor writes temporary files that are causing extraneous recompiles when making changes. I have in my tsconfig.json:

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

I am using tsc --watch to watch for changes and compile.

This works, until I add a baseUrl to my config like so:

"baseUrl": "src",

I'm using baseUrl because I prefer absolute import paths over relative.

I have tried adjusting the exclude globs but cannot for the life of me get typescript to ignore these files when the baseUrl is set. Is there some reason that the file exclusions would not work with a baseUrl?

sliptype
  • 2,804
  • 1
  • 15
  • 26
  • Can you provide a code example? Also use `tsc --listFiles` and `tsc --traceResolution` to check, [what and why](https://github.com/Microsoft/TypeScript/wiki/FAQ#why-is-a-file-in-the-exclude-list-still-picked-up-by-the-compiler) files are included. – ford04 Sep 20 '19 at 06:15
  • are those excluded directories within the base url? – Mosia Thabo Feb 09 '20 at 02:15

1 Answers1

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.