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

[scoped-custom-element-registry] No support for isomorphic scripts #601

Open
jonathandewitt-dev opened this issue Dec 1, 2024 · 2 comments · May be fixed by #605
Open

[scoped-custom-element-registry] No support for isomorphic scripts #601

jonathandewitt-dev opened this issue Dec 1, 2024 · 2 comments · May be fixed by #605

Comments

@jonathandewitt-dev
Copy link

jonathandewitt-dev commented Dec 1, 2024

Description

I'm attempting to render DSD for web components on the server side. It's difficult to support scoped elements, however, because the polyfill is not server-friendly.

The polyfill must be statically imported before my code; conditionally loading the polyfill does not work.

Example

Simply import the library and launch the script using Node.

// example.js
import '@webcomponents/scoped-custom-element-registry';
node example.js

Expected behavior

No error should be thrown. Script should be ignored on the server.

Actual behavior

ReferenceError: ShadowRoot is not defined

Version

0.0.9

@sorvell
Copy link
Collaborator

sorvell commented Dec 20, 2024

There's currently no platform support for scoped custom elements in DSD. You'd have to use a polyfilled version of DSD for this to work. Because of this, it seems like there's really limited value in making the polyfill work in Node at the moment.

However, if you just want it to not produce an error, this seems reasonable and we'd welcome a PR for this.

@jonathandewitt-dev
Copy link
Author

That's perfectly fine, all I'm looking to achieve is importing without throwing errors. I'll work on a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants