DO NOT MERGE: Lazy load gpay instead of baked in #2744
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
FYI @fikus @ChrisAntaki @jpettitt
This is meant more of a demo for what lazily loading the pay.js script would look like.
Essentially:
Results:
Before:
dist/basic-subscriptions.js 199.02 kB │ gzip: 59.10 kBAfter:
dist/basic-subscriptions.js 163.02 kB │ gzip: 48.90 kBThats an 18% decrease in raw bundle size and a 17.26% decrease in zipped size. Thats fairly significant, plus it removes tech debt from our end on needing to maintain a copy of it
Complications:

If we want to just directly use it the way we currently do, the web-activities code in pay.js needs to expose its public methods since they are getting renamed at the moment