parse-community / Parse-SDK-JS

The JavaScript SDK for Parse Platform
https://parseplatform.org
Apache License 2.0
1.32k stars 596 forks source link

Parse error in vite ( back4app ) on Parse.initialize: EventEmitter is not a constructor #2181

Closed sorooshjaberi closed 3 months ago

sorooshjaberi commented 3 months ago

New Issue Checklist

Issue Description

When calling Parse.initialize with the proper arguments in my vite react application, I get this error: EventEmitter is not a constructor

This is the corresponding code: parse-code

Steps to reproduce

  1. Create a vite app ( mine was a react-ts one )
  2. Try to initialize parse SDK in the app
  3. You will get the error below

Actual Outcome

parse-error

Expected Outcome

No errors

Workaround

Install the events package pnpm install events

Environment

Server

Database

Client

Logs

parse-github-assistant[bot] commented 3 months ago

Thanks for opening this issue!

dplewis commented 3 months ago

Duplicate https://github.com/parse-community/Parse-SDK-JS/issues/1766

You need to polyfill the event emitter.

We could replace the node event emitter with a custom isomorphic event emitter.