PhpStorm中如何处理node_modules

How to deal with node_modules in PhpStorm

我一直在为我的 Laravel/AngularJS 项目设置开发环境。我的 IDE 是 JetBrains PhpStorm。我想知道配置 IDE 以处理 node_modules(或 bower_componentsvendor 用于我的 PHP)文件夹的最佳做法是什么,以便:

  1. 就模块的内部代码而言,它不包含在code inspection中。
  2. 就我自己的代码中对模块的引用而言,它包含在 code inspection 中。
  3. 它包含在AutocompleteCode Navigation中(Ctrl+点击方法)

为了更清楚:我希望能够按住 Ctrl 键并单击我的节点模块的方法,然后重定向到这些模块的源代码。如果我写错了节点模块方法,或者它不存在,我也想得到警告。当我按下 Ctrl+Space 时,也会自动完成一个方法。 但是我不希望我的节点模块的内部代码被包含在代码检查中,因为检查所有需要花费很多时间模块,它们应该没问题,所以我不需要检查它们。


我已经尝试了两种解决方案:

无论我怎么尝试,最好的处理方法是什么?

正如help, PhpStorm auto-excludes node_modules folder from indexing for better performance, adding the direct dependencies listed in package.json to javascript libraries中提到的完成等。所以处理node_modules的最佳方法是依赖IDE默认程序