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

Consider removing Bluebird #438

Closed
OrKoN opened this issue Mar 23, 2018 · 6 comments
Closed

Consider removing Bluebird #438

OrKoN opened this issue Mar 23, 2018 · 6 comments

Comments

@OrKoN
Copy link

OrKoN commented Mar 23, 2018

Hi,

I was wondering why do you need Bluebird as a dependency? I am packaging this module for AWS Lambda and want to optimize the size of the final bundle. Here is what I see: stripe-node takes 102 KB, bluebird requires 613 KB!

I think the library may not need such a heavy dependency. Is it possible to remove it?

@OrKoN OrKoN changed the title Remove Bluebird Consider removing Bluebird Mar 23, 2018
@OrKoN
Copy link
Author

OrKoN commented Mar 23, 2018

It seems like you require bluebird only in this file https://github.com/stripe/stripe-node/blob/7abdb8913ab927bcde07f1d0b9b61ef1048b9269/lib/StripeMethod.basic.js

And the rest of occurrences is in the test files.

@ob-stripe
Copy link
Contributor

@OrKoN The dependency was introduced when the library needed to support Node 0.x and native ES6 promises weren't available.

Now that the minimum required version is Node 4, I suppose we could remove the dependency in favor of native promises. That said, Bluebird seems to have significantly better performance than native promises (according to https://github.com/petkaantonov/bluebird/tree/master/benchmark) so this is something we'd need to consider carefully.

cc @brandur-stripe @jlomas-stripe, any thoughts on this?

@OrKoN
Copy link
Author

OrKoN commented Mar 23, 2018

@ob-stripe I think this info on bluebird's site may be outdated (results are from 2015-01-05). Alternatively, you can optionally accept a different promise implementation if someone wants to use Bluebird.

@ob-stripe
Copy link
Contributor

you can optionally accept a different promise implementation if someone wants to use Bluebird.

I like this! I've prepared a patch in #439.

@OrKoN
Copy link
Author

OrKoN commented Mar 24, 2018

@ob-stripe I am positively surprised by how fast you respond 👍 I hope the PR can be merged soon. I think this will definitely help people who use Stripe with AWS Lambda and other similar services.

@ob-stripe
Copy link
Contributor

@OrKoN I've just released version 5.6.0 of the library with native ES6 promises instead of Bluebird :) Thanks for the suggestion!

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

2 participants