stop indexing node_modules folder !

Hi,

How can I stop indexing "node_modules" folder ? It's excluded but still under indexing by Webstorm.

Webstorm version is 2018.1.2

6
12 comments

This is the expected behavior - node_modules are auto-excluded from indexing, but direct dependencies listed in package.json are added to JavaScript Libraries for completion/type resolving and thus are indexed.

You can remove/disable the <project_name>/node_modules library in Settings | Languages & Frameworks | JavaScript | Libraries to exclude node_modules completely. But note that you will lose completion/auto-import/navigation.

3

seems like restart is required after removing that folder.

I wonder who ever needs auto completion from node_modules directory (usually it has production version, minimized, etc), but thank you for your help !

-5

>I wonder who ever needs auto completion from node_modules directory

Hmm... When you require some library, you normally want the functions defined in it to be available in completion, need to navigate to library definition, etc. This is a typical scenario.

Of course, if everything in your node_modules is an auxiliary stuff used for building/bundling/testing your code, you can safely exclude the folder completely

6

Thanks for the explanation @Elena. And yeah, I indeed use the libraries I install through npm, please leave that auto-complete in :)

3

How does intellij differentiate between build and runtime libraries, and correlate that with devDependencies and dependencies respectively?

Does IntelliJ process all folders in node_modules, or just those directly specified in dependencies and/or devDependencies.

What do I have control over aside from all or nothing?

0

>Does IntelliJ process all folders in node_modules, or just those directly specified in dependencies and/or devDependencies.

only those that are explicitly listed in dependencies and devDependencies are indexed, others are ignored

0

hi Elena,

after some upgrade which happened to webstorm it started to index node_modules folder again.

I do understand what you mean by saying "This is the expected behavior", but I don't want to let the webstorm to check these folders at all. Not for any reason.

As always, these folders are marked as excluded.

Do you need some screenshots to better understand what I'm talking about ?

 

Thanks,

Dima

 

0

here is the ongoing indexing process:

the folder I blurred is one from the disabled on the next screenshot with settings.

my settings:

1

Libraries are not disabled, as far as I can see from screenshot - they are enabled for certain scope.See https://www.jetbrains.com/help/webstorm/2019.1/settings-javascript-libraries.html:

A checkbox is marked with a Dash (-) if the corresponding library is defined and enabled on a more detailed level, for example, in a directory or in a file.

You need to clear Enabled checkboxes to disable libraries

0

I see, thank you.

0
Avatar
Permanently deleted user

I don't get this "libraries" config at all. Not possible to add new directories (either adding is disabled or file picker is being open instead of directory picker). Counter-intuitive content where "-" means kinda enabled... this sucks. Rest of the settings are easy to use. Please "don't make me think" when using this part.

I just want Rider to stop indexing node_modules out of scope of the projects inside my solution. The only special thing about my setup is that it is git monorepo with solutions (.sln) for frontend and couple backend services. I frequently get blocked for 2-5 minutes - e.g. can't rename a stupid file! until the indexing is finished.

Could someone point me to some global (not per project) setting that would make every **/node_modules disappear so that Rider can boot up in reasonable time? I already get enough slowdown from Windows and its Defender (exclusion rules did not make a difference).

0

>Could someone point me to some global (not per project) setting that would make every **/node_modules disappear so that Rider can boot up in reasonable time?

Try adding node_modules to the Ignore files and folders list (https://www.jetbrains.com/help/webstorm/2019.2/creating-and-registering-file-types.html#ignore-files-folders) in Settings | Editor | File Types

But note that ignored files are not indexed and not shown in the Project tree view

2

Please sign in to leave a comment.