redefine-custom-elements icon indicating copy to clipboard operation
redefine-custom-elements copied to clipboard

Potentially broken; will not re-define my custom element

Open segfall opened this issue 1 year ago • 2 comments

Hello,

I've imported the redefine-custom-elements module and tried to use it with my HMR setup.

Unfortunately, on hot reload, I get this error:

DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "component-name" has already been used with this registry

Does this script still work for others?

segfall avatar Nov 20 '24 16:11 segfall

Oddly enough, when I slow the execution down and debug through each statement in "redefine-custom-elements", no errors are reported in the console. However, my web component is still not hot-reloaded.

segfall avatar Nov 20 '24 16:11 segfall

Oddly enough, when I slow the execution down and debug through each statement in "redefine-custom-elements", no errors are reported in the console. However, my web component is still not hot-reloaded.

I've found this script works best when linked in the html <head>. It needs to execute before any components are imported/registered.

brian-patrick-kyndryl avatar Oct 15 '25 15:10 brian-patrick-kyndryl