OpenVidu / openvidu-tutorials

OpenVidu tutorials to get started
http://openvidu.io/tutorials
Apache License 2.0
228 stars 255 forks source link

DOMException: Failed to execute 'define' on 'CustomElementRegistry' #113

Closed paulohlimamaia closed 4 years ago

paulohlimamaia commented 4 years ago

I do not know exactly what i'm doing wrong, but i have a Vue project and i'm loading openvidu-webcomponent-2.14.0.js in it. When i'm on a localhost environment, it works great, but when i build my project and deploy to AWS, i get this error:

DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "openvidu-webcomponent" has already been used with this registry

and this error prevents my project to open up correctly, if i remove it from my index.html then my project loads but if i insert this js (<script src=js/openvidu-webcomponent-2.14.0.js></script>) then it won't work.

I tried fixing the definition of the component, using another name or checking if it already exists but this won't solve the problem.

Sorry if this was already mentioned in the docs but i was not able to find it.

CSantosM commented 4 years ago

Hello @paulohlimamaia,

We've never had this problem, but researching a little it's because of the openvidu-webcomponent has already defined.

Could you test changing this name https://github.com/OpenVidu/openvidu-call/blob/32ffe64d62d54fa88f5bd7fd93154b7f8e9d5ca5/openvidu-call-front/src/app/app.module.ts#L136

and build the webcomponent again you have the same issue?

paulohlimamaia commented 4 years ago

I tried changing to openvidu-component but i simple got the same error with the new name:

DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "openvidu-component" has already been used with this registry

I'm thinking the problem is in the compatibility of the openvidu-webcomponent-2.14.0.js with my VueJS v2.6.11 project. But the strange thing is when i'm in a Vue Development Server Mode, i do not get this error, i can use de webcomponent just fine to make video conference calls inside my project with no problems whatsoever, but if i build my project and include this, i get this error.

CSantosM commented 4 years ago

I have zero knowledge about Vue but if the development mode is working fine, something is happening in the builld stage.

Please, do a research and if is something wrong with openvidu-webcomponent, we'll fix it.

paulohlimamaia commented 4 years ago

It was possibly a problem on compatibility, i get around my issue by creating another project without VueJS and linking it to my main project as a module.