3

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

Community
  • 1
  • 1
Kiran Kota
  • 103
  • 1
  • 12

1 Answers1

1

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

yscik
  • 879
  • 4
  • 7
  • Nice find, looks like it may be fixed in the next version. Another workaround from a comment in a linked issue: (1) rename node_modules to something (2) restart IDE (3) rename something to node_modules This only works if you're in the habit of leaving your IDE running. It will revert on the next restart – Kiran Kota Oct 03 '16 at 17:16