LottieFiles / lottie-player

Lottie viewer/player as an easy to use web component! https://lottiefiles.com/web-player
MIT License
1.55k stars 175 forks source link

Page crash after HMR #171

Closed hslee2008 closed 2 years ago

hslee2008 commented 2 years ago
This page crashed.
Failed to execute 'define' on 'CustomElementRegistry': the name "lottie-player" has already been used with this registry

Try again

화면 캡처 2022-07-16 115401

I have to reload the page to not get the error. Happens every time I change code.

samuelOsborne commented 2 years ago

@HyunseungLee-Travis This happens when loading the script multiple times on the same page.

stephenhebert commented 1 year ago

There are times when it is not possible to avoid running the script multiple times, for instance when two libraries that use the component are used together in the same project. This is the issue that I am encountering currently. Would it be possible to check whether the element is already defined before defining it? This guide has an example: https://medium.com/tuitech/implement-a-ui-library-with-web-components-de0bffcf39ff