vmware-clarity / core

Clarity is a scalable, accessible, customizable, open-source design system built with web components. Works with any JavaScript framework, created for enterprises, and designed to be inclusive.
https://clarity.design
MIT License
163 stars 41 forks source link

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

Open swathishetty opened 1 year ago

swathishetty commented 1 year ago

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

kevinbuhmann commented 1 year ago

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.

swathishetty commented 1 year ago

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?

kevinbuhmann commented 1 year ago

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.