Angular modules, directives, services etc can't resolve, show unused and missing imports for external and library
Hi,
All of a sudden I'm running into a issue where Webstorm can't seem to resolve external and library modules. For instance, it shows all my methods in my services located in my library as unused.
Please sign in to leave a comment.
As it recognizes your HTML as Angular template, Angular support is on. So it must be a different problem.
Did you try invalidating caches (File > Invalidate caches, Invalidate and restart)?
Hi Elena,
That was the issue, it's solved now. Thanks for all the help.
Most probably Angular support is not enabled. Are Angular directives, etc. recognized in HTML files? Please select your .html file in the Project tool window and hit F1 (View | Quick Documentation) - what docs are shows? Please attach a screenshot.
Your idea.log (Help | Show Log in ...) would be also helpful
It tells me it's an HTML (Angular HTML template)
I cannot upload a log here since it only accepts img extensions.
At least a hundred times already :)
can you share a project that can be used to recreate the issue?
Sadly I cannot. I still have these issues though where Webstorm is unable to resolve my library.
If you can't share your actual code, try composing a sample project that shows up the issue
Here's a sample project: https://github.com/lwensveen/webstorm-angular-test
As you can see the tsconfig has a paths property, yet it's impossible to have the path resolve when you import
Do you mean errors in imports like
In your tsconfig.json, you have the following path mappings:
But there is no dist folder in your project, you have to build your library (ng build swag) to get it created. Once you do this, the error will go away:
I did that, I think the issue is that the dist folder is marked as excluded. Might have to remove that, will report later how it went.
Yes, it can be the issue - though the TypeScript language service can process excluded folders (and thus the import path is resolved in .ts file), types resolving in Angular templates is based on the index that the IDE builds, so the properties from excluded folders won't be recognized