3 ways to hide node_modules in vscode

3 ways to hide node_modules in vscode

In the short concise article, I will show you 3 ways to hide the node_modules directory in vscode (Visual Studio Code).

Method 1: Hide Node Modules vscode extension

Hide Node Modules is a great little vscode module created by Chris Bibby that does exactly what you want. The extension adds a right-click context menu action to show/hide the node_module folder in your javascript/nodejs projects.

  • In vscode click Extensions
  • Search for “Hide Node Modules
  • Choose the extension and click “Install
  • Back in file Explorer, right click and choose “Show/Hide Node Modules
video demonstrating the Show/Hide node_modules vscode extension.

Method 2: Hide node_modules in .vscode/settings.json

Time needed: 1 minute

  1. Create a folder in your project folder called .vscode

  2. Create a settings.json file inside .vscode, (i.e. .vscode/settings.json )

  3. Add the file.exclude setting with “**/node_modules” set to true

Method 3: Hide node_modules in .code-workspace file

This method is almost exactly like method 2 except we add the files.exclude setting in a vscode workspace file. This is the method used behind the scene by the Hide Node Modules extension.

# ./myproject.code-workspace
    "folders": [
            "path": "frontend"
    "settings": {
        "files.exclude": {

            "**/node_modules": true


One Reply to “3 ways to hide node_modules in vscode”

  1. Thank you for the good informations.
    At method 2 is’t : “files” not “file”.
    “files.exclude”: “**/node_modules”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.