Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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"
}
like image 475
MonkeyBonkey Avatar asked May 18 '15 22:05

MonkeyBonkey


People also ask

How do I ignore node modules in VS code?

vscode folder. Locate the line "**/node_modules": true within "files. exclude": { ... } Change the value to "**/node_modules": false.

Should node modules be ignored?

You should not include folder node_modules in your . gitignore file (or rather you should include folder node_modules in your source deployed to Heroku). If folder node_modules: exists then npm install will use those vendored libraries and will rebuild any binary dependencies with npm rebuild .

How do I get the node modules folder in Visual Studio code?

Go to settings, search for files. exclude and ensure that you haven't excluded the directory in user settings and/or workspace settings. If you want search results to include node_modules by default, you'll need to remove the pattern from the search. exclude setting.


1 Answers

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
        }
}
like image 87
Martin Möhnen Avatar answered Sep 22 '22 23:09

Martin Möhnen