core icon indicating copy to clipboard operation
core copied to clipboard

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

Open swathishetty opened this issue 1 year ago • 3 comments

I am trying to build a plugin on virtual cloud direct(VCD) container. The VCD container already has the clr-icon registered. I am using a third party library in the plugin which internally uses clarity icons(custom icons).I am getting the below error on integrating the plugin to the application because of the re-registration. image

Is there any way to fix this issue ? Thanks

swathishetty avatar Aug 28 '23 14:08 swathishetty

I think you will need to make sure your application does not register the same element/tag twice. This is an issue your application code, not the library. You can check if an element has already been registered by calling customElements.get('tag-name').

Note that clr-icon is no longer supported in favor of cds-icon.

kevinbuhmann avatar Aug 28 '23 15:08 kevinbuhmann

just on importing an external module in the code i am getting this error. The external module is using clr-icons internally. On plugging in this code(with external module) to the VMware Cloud Director Portal, I am getting the registery error. As per my understanding the VMware Cloud Director Portal also uses clarity and clr-icons. Does any additional webpack configuration would help in overriding the central registry and pick the one loaded from plugin code?

swathishetty avatar Aug 28 '23 15:08 swathishetty

You might have to address the issue with your dependency. I am not sure about solving it with webpack, but there might a way to replace to register.js file with a no-op file.

kevinbuhmann avatar Aug 28 '23 15:08 kevinbuhmann