AgoraIO-Community / Agora-RTC-React

A react wrapper for Agora RTC NG SDK
MIT License
92 stars 48 forks source link

Vite Build Failing #55

Open ehubbell opened 1 year ago

ehubbell commented 1 year ago

We recently upgraded our application from CRA to Vite and are running into issues with this library (and the agora-rtc-sdk-ng library) when trying to preview a build. I both scenarios, we get the following console error when trying to preview the build:

it is not a constructor or e is not a constructor with the stack trace originating from the Agora library import. We then tried dynamically importing the library, which allowed the page to load, but then ran into the issue again when we go to initialize the library.

Prior to Vite, we had the library working fine with CRA. And, we've tried configuring Vite with ESNext and ES2015 build targets using terser but none of those options have worked. We also tried to getting the Quick Demo React to work (available here: https://github.com/AgoraIO/agora-rtc-web/tree/main/projects/quick-demo-react) but that runs into an Agora-RTE-Extension--1.2.4.tgz not found 404 error when running pnpm i.

Any ideas on how to get the Vite build working?