Reputation: 47871
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"
}
Upvotes: 25
Views: 45167
Reputation: 250882
If you don't supply a files
list, VSCode will compile everything.
{
"compilerOptions": {
"target": "ES5"
}
}
You can change this by supplying a list of the files you want compiled, e.g:
{
"compilerOptions": {
"target": "ES6"
},
"files": [
"app.ts",
"other.ts",
"more.ts"
]
}
Upvotes: 8
Reputation: 610
You can now use exclude
in your tsconfig.json file:
{
"exclude": [
"node_modules",
],
"compilerOptions": {
...
}
}
https://github.com/Microsoft/TypeScript/wiki/tsconfig.json
Note it's a sibling to, not child of, compilerOptions.
Upvotes: 20
Reputation: 2983
Here is a way to get you by, don't use tsconfig.json for now it doesn't support excludes which you will need. What I want is simply to compile the file you are on with options using tasks.json. For now you have to CTRL+SHIFT+B to build, there is no nice way to build upon saving yet.
{
"version": "0.1.0",
// The command is tsc. Assumes that tsc has been installed using npm install -g typescript
"command": "tsc",
// The command is a shell script
"isShellCommand": true,
// Show the output window only if unrecognized errors occur.
"showOutput": "always",
// args is the HelloWorld program to compile.
"args": ["${file}", "--module", "amd", "--target", "ES5"],
// use the standard tsc problem matcher to find compile problems
// in the output.
"problemMatcher": "$tsc"
}
Upvotes: 0
Reputation: 522
In Version 0.5 you can hide files and folders
Open Files->Preferences->User Settings and add something like
{
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
"jspm_packages" : true,
"node_modules" : true
}
}
Upvotes: 30