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

fix: remove async/await usage to avoid babel polyfill #150

Merged
merged 1 commit into from
Aug 27, 2021

Conversation

gregjopa
Copy link
Contributor

The bundle size did increase with in the latest releases due to using the async/await syntax and it getting polyfilled by babel.

https://bundlephobia.com/package/@paypal/react-paypal-js

This PR removes the async/await usage in favor of native Promises which reduces the overall bundle size (goes from 14 to 12 KB):

Screen Shot 2021-08-27 at 12 30 46 PM

@gregjopa gregjopa requested a review from a team as a code owner August 27, 2021 17:33
@codecov
Copy link

codecov bot commented Aug 27, 2021

Codecov Report

Merging #150 (fbbe3d6) into main (a407cb8) will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #150      +/-   ##
==========================================
+ Coverage   96.00%   96.05%   +0.05%     
==========================================
  Files          11       11              
  Lines         225      228       +3     
  Branches       68       68              
==========================================
+ Hits          216      219       +3     
  Misses          9        9              
Impacted Files Coverage Δ
...rc/components/braintree/BraintreePayPalButtons.tsx 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a407cb8...fbbe3d6. Read the comment docs.

@gregjopa gregjopa merged commit ecaf084 into main Aug 27, 2021
@gregjopa gregjopa deleted the remove-async-await branch August 27, 2021 17:46
Copy link
Contributor

@borodovisin borodovisin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good I'll try to avoid the use of async/await in our code

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

Successfully merging this pull request may close these issues.

None yet

2 participants