How To Deal With Node_modules In PhpStorm
I have been setting up my development environment for my Laravel/AngularJS
project. My IDE is JetBrains PhpStorm. I am wondering what are the best practices for configuring the IDE to deal with the node_modules
(or bower_components
or vendor
for my PHP) folder, so that:
- It is not included in the
code inspection
as far as the modules' internal code is concerned. - It is included in the
code inspection
as far as references in my own code to the modules is concerned. - It is included in
Autocomplete
orCode Navigation
(Ctrl+click on methods)
To make it more clear: I want to be able to Ctrl+click on methods of my node modules and be redirected to the source code of these modules. I also want to be warned if I write a node module method wrong, or if it does not exist. Also autocomplete a method, when I press Ctrl+Space. But I don't want the internal code of my node modules to be included in code inspection, because it takes a lot of time to inspect all the modules, and they are supposed to be ok, so I don't need to inspect them.
I already tried two solutions:
- Marking the folders as excluded: This does not work because the folders are totally excluded from the project and redirection and inspection does not work at all
- Creating a specific
Scope
(in PhpStorm Settings), that includes all files except thenode_modules
folder, to use when I manually runCode Inspection
: It is impossible to exclude thenode_modules
folder, because my IDE recognizes it as a module "I think" (it has [webapp] next to it in the Project explorer). I could however excludebower_components
andvendor
.
Regardless my tries, what is the best way to deal with it?
Answer
As it's mentioned in help, PhpStorm auto-excludes node_modules
folder from indexing for better performance, adding the direct dependencies listed in package.json
to javascript libraries for completion, etc. So the best way to handle node_modules
is relying on the IDE default procedures
Related Questions
- → Maximum call stack exceeded when instantiating class inside of a module
- → Browserify api: how to pass advanced option to script
- → Node.js Passing object from server.js to external modules?
- → gulp-rename makes copies, but does not replace
- → requiring RX.js in node.js
- → Remove an ObjectId from an array of objectId
- → Can not connect to Redis
- → React: How to publish page on server using React-starter-kit
- → Express - better pattern for passing data between middleware functions
- → Can't get plotly + node.js to stream data coming through POST requests
- → IsGenerator implementation
- → Async/Await not waiting
- → (Socket.io on nodejs) Updating div with mysql data stops without showing error