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

10 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.

2

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 !

-1

>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

2

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

1

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:

0

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

Please sign in to leave a comment.