-
Notifications
You must be signed in to change notification settings - Fork 122
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
No components, pipes, etc. found from within an Angular CLI library #340
Comments
Application to reproduce the issue: Follow the steps in the readme to see the issue |
You have to build it first, then reload VSCode. After this steps it should work, but keep in mind that the build files are locked after it, so you have to "Reload > Remove Build > Rebuild > Reload" in this cycle... it is a bad workflow i know, but actually the plugin locks the files with the duplicate TSServer running. |
Possible root cause: #457 |
I am having a similar experience with a slight difference. I created a project very similar to @arobinson. A workspace with a library project and an application project. I take advantage of the tsconfig.json path maps and import the library module without publishing it to npm. If I build the library before adding the import to the application, everything works fine. If I add a new component to the library, build, and try to use it in the application, I get the error that says it does not exists. If I delete the dist folder for the library build and rebuild and restart visual studio code, the error goes away. This is what I believe @JohnnyDevNull was saying. Is this expected behavior? Am I doing something incorrectly? If this is expected behavior, it seems like this makes the --watch option on the ng build command for the library useless. @kyliau - can you please confirm if this is expected behavior? Thanks. I am having trouble understanding why #457 and #244 apply here. I don't think either of those apply to my scenario. |
@granttw Based on your description, it looks like the language service is not picking up new metadata.json from the library after a new component is added. I can think of two possible solutions:
I'll explore (1) for now and see how much work it takes to fix this. |
@granttw you do everything right, that's the actual workflow with VSCode when developing with a local library, only WebStorm does it a bit better, but also there I have to reload in some edge cases. |
Same here. I have a monorepo setup with angular material module living in my shared library. |
This is impacting our workflow pretty severely. It's strange, but it used to work before 0.900. Does someone knows of any workarounds to get the library discovery work again? |
@alberto-chiesa Did you compile your library with flatModuleOutFile? Could you please check or paste your |
@kyliau nope. Should I? Sure, I can copy and paste the |
Btw, here it is my tsconfig.lib.json for the referenced library: And the base tsconfig in the root: |
I actually have a similar problem with a I grabbed a screenshot of a simple component with my pipe showing an error. I can probably make up an example project that shows this. This is with compiling my library project with your suggested Edit: Looks like @arobinson already took care of an example |
@alberto-chiesa You can uninstall the extension for now, this is what I did. |
Maybe this could help you out:
Extend the above to your path mapping in your main tsconfig.ts so that the local source get's collected when there is no build available. This improves the library development a lot, because you don't need to build it first. There is only one additional tweak left to get this working:
Then your local mapping works like a charm! Otherwise you have to follow the workflow describe here: #340 (comment) EDIT: The second path is for subentry points. |
I ran into this same issue where my custom pipes was not found. Take a look at my post #888 to see if it'll resolve yours since I got mine resolved. |
This has been fixed by the new Ivy-native language service, released in v11.1.0. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I just refactored our code to use an Angular library. At runtime, everything is working and rendered correctly, but this VSCode extension is saying that none of the components, directives, pipes, etc. can be found when the template HTML is open.
Example error:
And:
Our project layout is an Angular 7 (CLI) application with an Angular Library child project. None of the items from the Angular library are being found by this extension. Components from the application are found, it is only the library ones that are not working.
Once I get a chance I'll create a project on (like github) to reproduce the issue
Are there any known issues with this extension and using an Angular library in a child project of an angular application?
The text was updated successfully, but these errors were encountered: