OpenVidu / openvidu

OpenVidu Platform main repository

Home Page:https://openvidu.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Openvidu-browser gave an error when building with vite

InSooBae opened this issue · comments

Describe the bug

I am using openvidu-browser 2.24.0 with vue 3.2.37 + vite 2.9.14.

There is some problem when it build by vite.

(Works fine when run locally)

image

Expected behavior

I guess viteis always build strict-mode, so some files(in KurentoUtils/**) are giving errors.

It seems difficult to solve the problem with vite.
Because Vite cannot handle and does not support code that only runs on non-strict mode (sloppy mode). This is because Vite uses ESM and it is always strict mode inside ESM.

image

So I think we should make openvidu-browser build without problems in strict mode.

before build

image

after build

image

The reason for the error is that there is a problem with the default binding in strict-mode.

If you don't think you can solve this error, you should specify that it conflicts with vite.

Since I've switched to vitejs I'm not able to use openvidu neither, I have a similar error:

image

while in dev it's working perfectly...

Do you plan to make your openvidu-browser compatible with vitejs?

If someone experience the same problem I have solved it by not bundling the openvidu library with vite but I include it from a CDN and it works.

If someone experience the same problem I have solved it by not bundling the openvidu library with vite but I include it from a CDN and it works.

Alternatively, try "npm run build --no-strict" to avoid "strict mode"
https://rollupjs.org/configuration-options/#output-strict

Hi, could you please give me access to a Vue + Vite sample project and the steps that I should follow for reproducing this issue?

By updating the vitejs framework the the latest version (from 2.2.x->4.3.x), it also solves the problem, may be it's not worth to try to solve it for old vite version...

If someone experience the same problem I have solved it by not bundling the openvidu library with vite but I include it from a CDN and it works.

how can i get openvidu-cdn url?

If someone experience the same problem I have solved it by not bundling the openvidu library with vite but I include it from a CDN and it works.

how can i get openvidu-cdn url?

Last time I searched "Openvidu cdn" with my search engine. You can found something like: https://www.jsdelivr.com/package/npm/openvidu-browser