Issues with tree-shaking in v3 beta
See original GitHub issueIntended outcome:
I would expect these bundles to be roughly the same size:
import {Observable} from 'apollo-boost'
console.log(Observable)
and:
import {Observable} from '@apollo/client'
console.log(Observable)
Actual outcome:
The apollo-boost
bundle is 7.6 KiB, whereas the @apollo/client
bundle is 94.2 KiB.
How to reproduce the issue:
Compare this branch to this branch. To produce the bundle size measurements, check out either branch and run npm run build
.
Versions
For the apollo-boost
bundle:
System:
OS: macOS Mojave 10.14.6
Binaries:
Node: 12.13.1 - ~/.config/nvm/12.13.1/bin/node
npm: 6.13.4 - ~/.config/nvm/12.13.1/bin/npm
Browsers:
Chrome: 79.0.3945.79
Firefox: 69.0.2
Safari: 13.0.4
npmPackages:
apollo-boost: ^0.4.7 => 0.4.7
The @apollo/client
one is the same except:
npmPackages:
@apollo/client: 3.0.0-beta.34 => 3.0.0-beta.34
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:19 (7 by maintainers)
Top Results From Across the Web
How to use tree shaking in Webpack? - angular - Stack Overflow
I just updated to webpack 2.1.0-beta.15 with an Angular 2 (version rc.2) app (with Typescript), but I was wondering how to use the...
Read more >Tree Shaking - webpack
Clarifying tree shaking and sideEffects. The sideEffects and usedExports (more known as tree shaking) optimizations are two different things. sideEffects is ...
Read more >July 29, 2022 Release - React Spectrum Libraries - Adobe
These include tree shaking improvements, large dependency removal, ... @react-aria/checkbox@3.5.0 - @react-aria/color@3.0.0-beta.14 ...
Read more >Upgrade from version 8 to the modular Web SDK - Firebase
Modular - a new API surface designed to facilitate tree-shaking (removal of ... v8 to v9 beta, change your import statements to use...
Read more >VueJS 3.0.0 Beta: Features I'm Excited About - Bits and Pieces
Support is now also available in this version for things like tree-shaking. Most features that were optional in Vue are now tree-shakable, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for all the detailed info @miqdadfwz! We will dig into this before the Apollo Client v3.4 launch is finalized (though probably during the Release Candidate phase, since improving tree-shakeability should be relatively a transparent optimization, not a change in functionality).
Well I’m using the same webpack configuration (webpack v4), but ended up with significantly larger size comparing with former AC version.
Here is AC3 result using webpack bundle analyzer, it takes 39kb gzip along with
graphql
dependency. I’m afraid the tree shaking is partially not working here.And here for AC2 with same chunks combination and other AC2 dependecies such as
apollo-link-*
and@apollo/react-hooks
, it only takes 26kb.