Closed marco-carvalho closed 1 month ago
Hi there. The Node SDK is expected to run in an node environment. Unleash extends the EventEmitter, which only exists on Node.js and not in the browser.
To me it looks like you are trying to use the node SDK in a react application? In that case you are probably better off using the react SDK: https://github.com/Unleash/proxy-client-react
Describe the bug
Steps to reproduce the bug
yarn create vite app1 --template react-ts
npm install unleash-client
code src/unleashClient.ts
const unleashClient = initialize({ url: import.meta.env.VITE_UNLEASH_API_URL, appName: import.meta.env.VITE_UNLEASH_APP_NAME, customHeaders: { Authorization: import.meta.env.VITE_UNLEASH_API_TOKEN }, environment: import.meta.env.VITE_UNLEASH_ENV, });
unleashClient.on('ready', console.log);
export default unleashClient;