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

Bundle reductions inspired by examples/rollup app. #2842

Merged
merged 3 commits into from
Mar 5, 2019

Commits on Mar 5, 2019

  1. Eliminate compact helper function from Query.tsx.

    Undefined values were not necessarily a problem in this code, so the
    compact helper was probably not strictly necessary to begin with, but the
    most likely cause of undefined values was the unnecessary destructuring of
    props, and the enumeration of all properties when creating the new object.
    Object spread syntax is a better tool for this job.
    
    Perhaps more importantly, by eliminating the compact helper function,
    whose return type was any, we exposed some typing problems with the
    extractOptsFromProps method, which I have also fixed.
    benjamn committed Mar 5, 2019
    Configuration menu
    Copy the full SHA
    976b01b View commit details
    Browse the repository at this point in the history
  2. Stop inlining tslib helpers like __extends and __rest.

    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.
    benjamn committed Mar 5, 2019
    Configuration menu
    Copy the full SHA
    1cf60f8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9276dde View commit details
    Browse the repository at this point in the history