MonkeyBonkey MonkeyBonkey - 1 month ago 29
TypeScript Question

How to ignore `node_modules` folder during TypeScript build in VSCode

I'm using visual studio code IDE and typescript, how do I get it to ignore the node_modules folder during build? Or have it build

.ts
files on save? It is showing a lot of errors because it's trying to compile node_modules tsd.

Currently my tasks.json is

{
"version": "0.1.0",

// The command is tsc.
"command": "tsc",

// Show the output window only if unrecognized errors occur.
"showOutput": "silent",

// Under windows use tsc.exe. This ensures we don't need a shell.
"windows": {
"command": "tsc.exe"
},

"isShellCommand": true,

// args is the HelloWorld program to compile.
"args": [],



// use the standard tsc problem matcher to find compile problems
// in the output.
"problemMatcher": "$tsc"
}

Answer

you can now use (in your tsconfig.json file):

{
"exclude": [
    "node_modules",
]
}

https://github.com/Microsoft/TypeScript/wiki/tsconfig.json