Skip to content
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

Web Component Support Broken? #17448

Closed
fireflysemantics opened this issue Apr 12, 2020 · 6 comments
Closed

Web Component Support Broken? #17448

fireflysemantics opened this issue Apr 12, 2020 · 6 comments
Labels
needs: more info Reporter must clarify the issue

Comments

@fireflysemantics
Copy link

fireflysemantics commented Apr 12, 2020

Angular CLI generates es5 and es2015 production files and chooses which to load. I seems like this change broke the generation of Web Components.

Wrote the issue up with Github repositories for testing here:

https://stackoverflow.com/questions/61168457/fs-gist-js1-error-typeerror-i-createshadowroot-is-not-a-function-on-angular-we

I've tried testing the webcomponent created in a minimal enviornent:

https://github.com/fireflysemantics/fs-gist-minimal

When loaded it produces this error:

ERROR TypeError: n.createShadowRoot is not a function
at new si (fs-gist-2015.js:1)
at e.createRenderer (fs-gist-2015.js:1)
at fs-gist-2015.js:1

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Apr 13, 2020

Hi, sounds like you are using native shadow DOM which is only available in Chrome. createShawdowRoot is also deprecated and replaced by attachShadow https://developer.mozilla.org/en-US/docs/Web/API/Element/createShadowRoot

Looking at the encapsulation of the component in your project, the component is using ViewEncapsulation.Native, which is also deprecated. The recommended replacement is ViewEncapsulation.ShadowDom. More info: https://angular.io/api/core/Component#encapsulation

Can you check if changing this solves the issue?

Thanks.

@alan-agius4 alan-agius4 added the needs: more info Reporter must clarify the issue label Apr 13, 2020
@fireflysemantics
Copy link
Author

AWESOME - Changing to ViewEncapsulation.ShadowDom fixes it! Thanks! I updated both repositories for reference in case anyone else wants to play with this.

@fireflysemantics
Copy link
Author

@alan-agius4
Copy link
Collaborator

Hi @fireflysemantics, I'll answer on SO.

@fireflysemantics
Copy link
Author

@alan-agius4 Thanks for elaborating on the SO question. I ran into a new problem. This @Input property is not being set. This is the SO post. Any ideas?

https://stackoverflow.com/questions/61225191/angular-custom-element-input-property-not-initializing

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: more info Reporter must clarify the issue
Projects
None yet
Development

No branches or pull requests

2 participants