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

Duplicate dependencies when using ToggleButton - Failed to execute 'define' on 'CustomElementRegistry' #4

Open
HawkSK opened this issue Oct 31, 2020 · 0 comments

Comments

@HawkSK
Copy link

HawkSK commented Oct 31, 2020

Problem

I want to use in Java both ToggleButton and vcf-dark-mode-switch. However, my application breaks in the browser and the console reports:
Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "vcf-toggle-button" has already been used with this registry

How to reproduce

Using ToggleButton:

<dependency>
    <groupId>com.vaadin.componentfactory</groupId>
    <artifactId>togglebutton</artifactId>
    <version>1.0.0</version>
</dependency>

Using DarkModeSwitch:

@Tag("vcf-dark-mode-switch")
@NpmPackage(value = "@vaadin-component-factory/vcf-dark-mode-switch", version = "1.0.1")
@JsModule("@vaadin-component-factory/vcf-dark-mode-switch")
public class DarkModeSwitch extends AbstractSinglePropertyField<DarkModeSwitch, Boolean> {
    public DarkModeSwitch() {
        super("darkMode", false, false);
    }
}

(I am not sure if DarkModeSwitch can extend ToggleButton in some way, or it's composition so that would not work.)

Possible solution

npx find-duplicate-dependencies says:

This package has the following duplicate dependencies:

@vaadin-component-factory/vcf-toggle-button :
[ { name: '@vaadin-component-factory/vcf-toggle-button',
    version: '0.1.6',
    from: '@vaadin-component-factory/vcf-toggle-button@^0.1.1',
    path: 'no-name/@vaadin-component-factory/vcf-dark-mode-switch' },
  { name: '@vaadin-component-factory/vcf-toggle-button',
    version: '1.0.1',
    from: '@vaadin-component-factory/vcf-toggle-button@1.0.1',
    path: 'no-name' } ]

Please run "npm dedupe" to see if that could be fixed. If not, manually resolve version conflicts

...which indicates, that there are duplicates. IIUC ^0.1.1 means version above 1.0.0 is not accepted so I think the solution is to change the dependency of vcf-dark-mode-switch on vcf-toggle-button to a newer version, f.e. ^1.0.1.

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

No branches or pull requests

1 participant