Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': this name has already been used with this registry

前端 未结 3 1502
野趣味
野趣味 2020-12-17 20:42

Uncaught DOMException: Failed to execute \'define\' on \'CustomElementRegistry\': this name has already been used with this registry at http://127.0.0.1:8000/components/

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-17 21:16

    Well, this worked for me, with no Typescript warnings,

    if (!customElements.get('the-element')) { customElements.define('the-element', HTMLTheElement); }
    

    Hope someone will find this useful.

    Cheers.

提交回复
热议问题