how to tread node_modules folder when using angular plugin?
I am working with an angular projekt in webstorm. When I mark node_modules as excluded, the plugin does not work any more. Attributes like *ngIf are no longer filled in and in template files when I <ctrl>B on a method it is not found in the components ts file. When I unexclude node_modules, it works again, but node_modules is indexed, which takes a long time and when I search in all files node_modules is searched, which I don't want!
How do I set this correctly?
Please sign in to leave a comment.
Angular support can only be enabled if the corresponding @angular modules are included in index; this is normally done automatically - WebStorm scans the direct dependencies in project package.json and auto-adds them as libraries, excluding the rest stuff. You must have deleted/disabled the library... You can try creating it manually:
- exclude node_modules folder
- open Settings | Languages & Frameworks | JavaScript | Libraries, press Add...
- press +, choose Attach files
- select the node_modules/@angular folder, OK
When project re-indexing completes, Angular support should be there
After a restart node_modules is marked as "library root". I don't know why but everything works as expected.
I did not change anything.
Elena Pogorelova : Your suggested solution does not seem to work on Gradle project with Javascript. When I add the @angular folder as a library, Angular still doesn't regconize the directive (the node_modules are explicitly exclude in build.gradle).
Is there a way to resolve this or somehow exclude the whole node_modules folder in Gradle except for the @angular folder?
@nutatuna please follow https://youtrack.jetbrains.com/issue/IDEA-254213 for updates
Thanks!