Unable to use react sdk
# support
m
@Vapi Support Bot @Vapi can you help with this?
c
Hi Manny, Thanks for reporting this I was able to reproduce the issue on my end. Root Cause: The Vapi React SDK is published as a native ESM module, and
react-scripts
(from Create React App) has known limitations with fully handling modern ESM imports. This causes the runtime error you’re seeing when using the SDK in a CRA project. Recommended Fix: Since this project is experimental/testing, the easiest solution is to initialize your app with Vite, which has first-class support for ESM and works seamlessly with the Vapi React SDK. You can create a Vite-based React app like this:
Copy code
npm create vite@latest my-vapi-app -- --template react
Vite handles modern ESM-based packages out of the box, so the error should no longer occur. Let me know if you face the same issue in the React-Vite setup! Best, Vikash