react-popup icon indicating copy to clipboard operation
react-popup copied to clipboard

Missed `events` package causes crash

Open berdyshev opened this issue 10 months ago • 0 comments

The PopupStore class extends EventEmitter class from events package. There is a standard NodeJS library with such a name and a kind of polyfil as events package on NPM. Usually it might be already installed as a dependency in your project by other tools (in my cause it's webpack and its plugins) But if not, the react-popup package might brake an app.

Once I replaced Webpack with Vite the app broke with the following error:

Uncaught TypeError: Super expression must either be null or a function
    at _inherits (react-popup.js?v=5c9bd9e2:367:15)
    at react-popup.js?v=5c9bd9e2:430:7
    at node_modules/react-popup/dist/Store.js (react-popup.js?v=5c9bd9e2:506:6)

So, I would recommend to either add the events library as a dependency, or find another way to implement event emitting using browser's native APIs (e.g. EventTarget).

berdyshev avatar Apr 26 '24 11:04 berdyshev