In this official docs of Visual Code it's recommended to add node_modules
to the exclude
field of tsconfig.json. It is done this way:
{
"compilerOptions": {
"allowJs": true,
"checkJs": true
},
"exclude": ["node_modules", "**/node_modules/*"]
}
I wonder why **/node_modules/*
is needed if I'm already adding the plain node_modules
folder.
CodePudding user response:
**/node_modules/*
is a glob pattern meaning (from right to left) "anything under a node_modules
directory at any depth". See the glob
module for more details, it's highly likely it's the module used to interpret that pattern.
From their docs:
*
Matches 0 or more characters in a single path portion**
If a "globstar" is alone in a path portion, then it matches zero or more directories and subdirectories searching for matches. It does not crawl symlinked directories.