Registering a custom element from a chrome extension

For me it was sufficient to use @webcomponents/custom-elements package in my content.js.
Also webcomponents-sd-ce.js weights about 80kb and custom-elements.min.js only 16kb.

Just install it as a dependancy and import it in the content.js and let your package manager do the rest.

npm i @webcomponents/custom-elements
import '@webcomponents/custom-elements'

This is how I use it in my project popup-tab-switcher.


I believe that all these workarounds are not necessary and custom elements must work for extensions without polyfills. Please vote for the issue in Chrome bugs to draw attention to this flaw.

Leave a Comment