-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VSCode Angular 9 Auto-Import for Custom Libraries #37222
Comments
Does this reproduce in the latest VS Code insiders build with all extensions disabled? |
Good afternoon. Just installed VS Code insiders and ran it with all extensions disabled (actually being a new installation - no extensions installed). The same thing issue replicated. Version: 1.43.0-insider |
To replicate the issue I executed the following commands: - Proceed to a new Project Folder When that is complete, I try to use AngularLibraryService which is the angular library in one of the application components and the following error is prompted.
If the following line is added manually, the error goes removed and the application works perfectly.
|
Our dev team (5 people) also has this issue and has had it for sometime across multiple versions of vsc This is specific to angular libraries, in the same work space auto imports work fine for the app (src/app) but when working in the library (projects/libraryname/src) auto imports comes up with no suggestion |
@marcusingogo, after a number of days searching the web, I found that by adding the following code to the tsconfig.json should resolve the auto-import suggestion.
Can you please try it out and see if it works on your project as well ? |
@chrisebejermt I got the same issue, adding the code to tsconfig.json works for me!! 😄 |
Works for me thanks @chrisebejermt |
For Angular 13, below solution worked for me:
|
This solution works, but it also yields a design time error in VS code: 'Cannot find type definition file for |
TS Template added by @mjbvz
TypeScript Version: 3.8.3
Search Terms
I'm currently building an Angular 9 Library using VSCode (version 1.42.1 on MAC OS). I followed the Angular Tutorial on how to create libraries - https://angular.io/guide/creating-libraries.
I also added schematics to the angular package, I'm currently having problems when I add the Library to Angular Application using the
ng add ~/projects/my-library-0.01.tgz --save
command.VSCode is unable to auto-import components or classes defined in this package.
If I manually add
import { MyService } from 'my-library'
this works fines.Is there a reason why the auto-import is not working for custom angular libraries?
The text was updated successfully, but these errors were encountered: