Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Chore/reduce bundle size #2659

Merged
merged 8 commits into from
Dec 13, 2018
Merged

Chore/reduce bundle size #2659

merged 8 commits into from
Dec 13, 2018

Conversation

JoviDeCroock
Copy link
Contributor

Checklist:

  • If this PR is a new feature, please reference an issue where a consensus about the design was reached (not necessary for small changes)
  • Make sure all of the significant new logic is covered by tests
  • If this was a change that affects the external API used in GitHunt-React, update GitHunt-React and post a link to the PR in the discussion.

I attempted to reduce the bundlesize by removing dependencies, I personally prefer making several small PR's for this so we can handle problem by problem.

@JoviDeCroock
Copy link
Contributor Author

Thank you so much for the quick response, let's make this wonderfull OSS project even better.

@benjamn
Copy link
Member

benjamn commented Dec 13, 2018

Just as a heads up, I'm planning to open a PR here that mirrors apollographql/apollo-client#4234, so I will merge this PR into that branch once I've pushed it. We can publish beta versions to npm, but I'd like to keep track of how much bundle size we've saved, in one long-running PR.

@JoviDeCroock
Copy link
Contributor Author

Okay, i'll probably be posting more of these, my plan was to start at react-apollo and then move on to others.

@benjamn benjamn changed the base branch from master to wip-reduce-bundle-size December 13, 2018 21:04
@benjamn benjamn merged commit 4bac03a into apollographql:wip-reduce-bundle-size Dec 13, 2018
@JoviDeCroock JoviDeCroock deleted the chore/reduce-bundle-size branch December 13, 2018 21:09
benjamn pushed a commit that referenced this pull request Jan 20, 2019
Use our own flowRight-like function instead of using lodash.flowright.

In addition to being smaller, this implementation does not require using CommonJS require to import a separate package.
benjamn added a commit that referenced this pull request Mar 5, 2019
Similar in spirit to apollographql/apollo-link#959

This inlining was first introduced in PR #2661 with the following commit:
de2b5fc

At the time, inlining made sense because TypeScript was injecting copies
of the __extends, __rest, etc. helpers into every module that used them.
Depending on the tslib package seemed undesirable because the available
bundle size measurement tools (e.g. bundlephobia.com) mistakenly counted
the entire tslib package against react-apollo, without acknowledging the
possibility of sharing that package between multiple Apollo packages. It
seemed safer to inline only the helpers we needed at the top of
lib/react-apollo.esm.js.

Now that we have a more holistic way to measure bundle sizes (#2839), and
react-apollo works better with tree-shaking tools (#2659, #2661, #2677),
we know that overall application bundle sizes benefit from sharing a
single copy of the tslib helper package, even if no tree-shaking is
happening. Of course, with tree-shaking, that one copy of the tslib
package can be shrunk to contain just the helpers that are actually used.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants