VSCode Angular 9 Auto-Import for Custom Libraries
See original GitHub issueTS Template added by @mjbvz
TypeScript Version: 3.8.3
Search Terms
- angular
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.
Cannot find name ‘MyService’.
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?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Visual Studio Code Automatic Imports - typescript
TypeScript Importer works well, also with custom rootDirs or mappings using paths in tsconfig.json . It fixes the broken autoimport of VS Code....
Read more >Visual Studio Code Extension - Auto Import - YouTube
Visual Studio Code Extension - Auto ImportIn this video, we take a look at the Auto Import extension within Visual Studio Code.
Read more >Auto Import - Visual Studio Marketplace
Automatically finds, parses and provides code actions and code completion for all available imports. Works with Typescript and TSX. Big thanks ...
Read more >Enable JavaScript auto-import suggestions in VS Code
As of 2018, VS Code treats all JS files as separate from one another. In order to tell it that your files are...
Read more >Angular Language Service
In Visual Studio Code, install the extension from the Extensions: Marketplace. Open the marketplace from the editor using the Extensions icon on the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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 ?
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