-
Notifications
You must be signed in to change notification settings - Fork 792
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
bug: Unable to run Angular test app outside monorepo and import Stencil component successfully #5497
Comments
This is a bump on #3362, which apparently still exists. |
@withinsight I am having a hard time getting to a reproducible state. After checking out withinsight/stencil-angular-output-external-consumer I can't build the project because |
@christian-bromann You have to link packages using in The former makes This is described in the Stencil Angular docs but I guess I didn't describe it here, but this is essentially how you "mock" import packages before they're actually available on npm, or can test package changes locally before publishing them in your actual package. |
Today's update: it appears that once the package from The Stencil Angular docs really should mention this, and I may take Ryan's advice from Discord to update the docs to talk a little about packages and maybe have others who are attempting to do what I'm doing avoid losing a week's work to npm doldrums. |
My guess is that when you |
@christian-bromann Great, glad you were able to get this far. So in It would be good if you are able to confirm the above, however, it goes away when I import |
No, I get:
Are you on Windows maybe? |
Have you opened the browser? Looks like you're only on the command line. This error is in the browser JS console. |
Ups, yes, looking into the browser console revealed the error. I will ingest this into our backlog for the team to take a look at. |
Same issue here but not in the monorepo structure. In angular 17.3.8 with standalone components, impossible to use the web components. I have the same NG0203 error |
For me it's solved when you call the defineCustomElements function in your main.ts file. The defineCustomElements function is coming from your core library. This is also a monorepo setup, based upon the boilerplate: https://github.com/stencil-community/designsystem-boilerplate/tree/main |
Prerequisites
Stencil Version
4.7.0
Current Behavior
Following the guide at: https://stenciljs.com/docs/angular, I've got a monorepo with one package for Stencil, another for the Angular target. I'm using the
dist
output with an Angular outputType ofcomponent
.I have everything working in the repo. I'm able to import and run the test app successfully. The import is using the library name (per Angular docs):
import { ComponentModule } from 'components';
When I build an Angular workspace, library and test app external to the monorepo, this is when I receive the error. Note that I'm using
npm link
to achieve package imports as everything is currently local (I also usednpm link
to import the Stencil package in the Angular package in the monorepo).When I import the module the same way:
import { ComponentModule } from '@package/component-name/dist/components';
(have to point to
/dist/components
because npm link points you to the root directory of the package).Running
ng serve
is successful, however this is the browser error:Expected Behavior
The Stencil component wrapped in Angular should import and display the same in an external test Angular app as it does in the test Angular app located in the monorepo.
System Info
Steps to Reproduce
#1 Follow the instructions at https://stenciljs.com/docs/angular, note the component works in the test app.
#2 Create a new Angular workspace & test app in a new location on your machine. Symlink to the Angular target package from the new Angular test app. Run the Angular test app in browser.
Code Reproduction URL
Repo for #1 above: https://github.com/withinsight/stencil-angular-output
Repo for #2 above: https://github.com/withinsight/stencil-angular-output-external-consumer
Additional Information
Angular: 14.2
Node: 16.10
The text was updated successfully, but these errors were encountered: