Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not depend on events? #55

Closed
olofd opened this issue Feb 23, 2019 · 7 comments
Closed

Not depend on events? #55

olofd opened this issue Feb 23, 2019 · 7 comments

Comments

@olofd
Copy link

olofd commented Feb 23, 2019

In 3.1.0 the dependency of EE => events was introduced. That means this library does no longer work on the web.

@RobTS
Copy link

RobTS commented Feb 24, 2019

Nor does it work on React Native any more

@olofd
Copy link
Author

olofd commented Feb 24, 2019

@sindresorhus Can we use this: https://github.com/primus/eventemitter3 or something instead?

@sindresorhus
Copy link
Owner

I think Webpack shims the events module (?)

@olofd
Copy link
Author

olofd commented Feb 26, 2019

React Native uses Metro, not Webpack. And why would we need to shim a package to make an easy module like this to be platform independent?

I think the best solution is to have your own event-emitter included if you want to use one in the package and not have dependencies for simple stuff like this. But that's my opinion.

@sindresorhus
Copy link
Owner

@olofd I would usually disagree, as my main target is Node.js. Bundlers enable support for browsers, etc. But I'm willing to make an exception here as this module is fairly popular for React Native and browser usage.

PR welcome to use https://github.com/primus/eventemitter3 and update to docs to reflect that fact.

@vladimiry
Copy link

vladimiry commented Mar 2, 2019

I think Webpack shims the events module (?)

  • Webpack is not the only bundler.
  • Webpack doesn't always ship the events shim to the bundle. It won't do this for example in the case of electron-renderer target using.
  • Webpack v5 is going to completely stop shipping Node.js polyfills.

vladimiry added a commit to vladimiry/ElectronMail that referenced this issue Mar 2, 2019
* see sindresorhus/p-queue#55
* "find-in-page" widget is built with "electron-renderer" webpack's target and so webpack won't ship the "events" shim automatically since "events" module is marked as external based on the target
@rexxars
Copy link
Sponsor Contributor

rexxars commented Mar 6, 2019

Opened #58 to address this by replacing events with eventemitter3

devDefiWeb added a commit to devDefiWeb/electron-mail-app that referenced this issue May 28, 2022
* see sindresorhus/p-queue#55
* "find-in-page" widget is built with "electron-renderer" webpack's target and so webpack won't ship the "events" shim automatically since "events" module is marked as external based on the target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants