This VSCode extension adds the ability to show and hide the node_modules folder from within the file explorer, via a context-menu, shortcut keys, command palette or status bar. The option to show or hide the node_modules folder is only available if a package.json or package-lock.json is detected within the current workspace folder.
Features
Show and hide the node_modules folder
Explorer context menu
Auto hide node_modules when opening a new folder
Status bar indicator when hiding a node_modules folder
Setting configurable between workspace and global
How to use
Action
Windows / Linux
macOS
Command Palette
Hide Node Modules
ctrl-alt-n
cmd-alt-n
> Hide Node Modules
Show Node Modules
ctrl-alt-n
cmd-alt-n
> Show Node Modules
How to manually unhide node_modules
If a folder is opened in VSCode without the Hide Node Modules extension but had previously used it to hide the node_modules folder, VSCode will keep it hidden - the extension uses an option within the VSCode settings.json file to control visibility of the node_modules folder.
To unhide the node_modules folder without using the extension:
Open the settings.json file located within the .vscode folder
Locate the line "**/node_modules": true within "files.exclude": { ... }
Change the value to "**/node_modules": false
Save the file
The node_modules folder should now be visible again within the explorer.