Typescript auto-imports use full path instead of barrels
I have a rather substantial Angular project and for a very long time when I typed something like `@Component` and allowed it to auto-import I would get the correct import:
import { Component } from '@angular/core';
But then there was an update and now the same thing results in this import:
import { Component } from '@angular/core/src/metadata/directives';
Which the TypeScript compiler does not like. This change has dramatically impacted my development speed as I have to update the import every time and when I do something with a Component, Input, Output, Inject, or more they each get their own line that I have to correct.
Note that my webpack.config.js file will not import because it requires a target flag (production, dev, staging...). This has always been the case, so I don't think it is related, but maybe a recent change requires this?
I have tried invalidating my caches and deleting my node_modules folder with no success.
Please sign in to leave a comment.
What IDE version do you use? Can you recreate the issue when using a new Angular cli project? Also, do you have any symlinks in your project path?
I am currently using the most up to date WebStorm, the about says this:
I have confirmed that the "Use directory import when index.js is available" is checked and it works with non-angular code.
No ideas unfortunately... With default setting for imports it should just work