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.
**/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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.