Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include certain node_modules

Tags:

webstorm

Seems that in the latest WebStorm (2016.2.3?), node_modules is marked as an excluded directory by default. There are certain directories within node_modules that I want to include in my project files and searches. So I used to go to Preferences > Directories and exclude all of the modules I didn't need. However, I'm not able to "unexclude" the parent node_modules anymore. I have also tried unchecking the option in Preferences > Languages > JavaScript > Libraries without luck.

Same question with screenshot, if needed: Can't remove node_modules from excluded folders in WebStorm

like image 405
Kiran Kota Avatar asked Aug 15 '26 02:08

Kiran Kota


1 Answers

Found out that when you have a package.json file, the node_modules is automatically excluded. Since you probably don't want to remove that, you could create an additional lib folder with symlinks to each module you want to include from node_modules.

If you are on Windows, you can use the mklink command for this, in Linux/Mac the file manager might have a Make link option, or just use ln -s node_modules/socket.io lib/ from the command line.

You could also install the modules you need indexed into subfolder/node_modules, with subfolder having no package.json, and only the top-level node_modules folder will be marked as library.

Related issue: https://youtrack.jetbrains.com/issue/WEB-22909

like image 93
yscik Avatar answered Aug 17 '26 12:08

yscik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!