exk0730
exk0730

Reputation: 733

Angular Material (v8) module import errors

I'm having some annoying issues with the new version of Angular Material. I just upgraded from 7.x.x to 8.1 for Material (and 7.x.x to 8.1 for Angular), but in my module imports, I'm getting errors in WebStorm. Not sure if this is related to WebStorm, Angular, or some TS configuration and was wondering if anyone had any ideas.

This is occurring in every module where I import Material modules and for any Material module. It does NOT occur for component imports, only the module imports.

ng build --prod, ng serve --prod, and ng serve all work fine, but my editor still seems to complain.

Things I've already tried which have not worked:

EDIT

Per Morphyish's comment, I did a Code -> Inspect code... on my entire project.

Almost everywhere I import a module from angular is broken. For example, I'm using the @angular/flex-layout so all of my fxFlex attributes are giving me "unknown HTML tag" errors. Even the ReactiveFormsModule is saying it's an invalid imported symbol. The project ng serves and ng builds correctly, so I don't know what's going on.

enter image description here

Upvotes: 0

Views: 261

Answers (2)

exk0730
exk0730

Reputation: 733

So, sometimes you just need to turn it off then on again. Morphyish was right, my IDE was drunk. I created a new project and copy/pasted all the files from my current project into it and ran Code -> Inspect Code... again. None of the errors from the original issue showed up. So I'm accepting Morphyish's answer as correct because he helped a lot, but if at first you don't succeed --- nuke everything.

Upvotes: 0

Morphyish
Morphyish

Reputation: 4062

Webstorm, and all Intellij IDEs really, can be a bit slow to parse all your files and update the errors and auto-completion. Give it a bit of time and it should be fine again. Sometimes restarting your IDE can help if it's really an issue but it shouldn't affect your project.

If you think you might have an issue with your actual files, you can always try to make sure the folder/file are actually in your node_modules folder.

Upvotes: 1

Related Questions