enable searching through node_modules using vscode

In this post I will tell you how to enable searching through node_modules using vscode.

Using vscode, by default searching through node_modules is disabled because obviously in most projects the amount of libraries included in node_modules is large. This will give a lot of noise when only searching for files within your own project. But what if you have a reason to search node_modules?

I want to be able to quickly open up the sources of a library I’m working with to see their implementation, when searching node_modules is disabled, I have to expand the file tree and manually go to the file each time. So for me it makes sense to enable searching through node_modules even if that makes my search results more noisy on average.

To enable searching through node_modules you must use the following configuration:

"search.exclude": {

(Note: At the time of writing I am using vscode 1.21.1)

The pattern containing node_modules in the search.exclude key is followed by false, in order to disable that pattern. It is enabled by default. This setting alone would be enough if you are sure that you do not have a .gitignore or .ignore file because the ignore file is also considered. So set that to false to disable accounting for the ignore file ignores.

I would like vscode to have a way to let me keep search.useIgnoreFiles=true and whitelist certain patterns that apply after blacklisting. (Hint: feature request)

Image showing a search for "bittrex" yielding desired results in vscode
Searching for “bittrex” in vscode gives my bittrex.js inside node_modules/ccxt which is what I want

Leave a Reply

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