common-shakeify icon indicating copy to clipboard operation
common-shakeify copied to clipboard

Fails to shake Apollo Client

Open tornqvist opened this issue 4 years ago • 0 comments

This plugin fails to shake Apollo Client leading to an immensely bloated bundle.

Apollo Client provides a CommonJS bundle, which allegedly is targeted for Node, but I can't see anything about that bundle which would throw off common-shakeify.

This simple example, which should include only the base ApolloClient class and its dependencies actually includes the entire Apollo Client bundle, resulting in a minified bundle size of ~490 kb.

// test.js
var { ApolloClient } = require('@apollo/client/core')
module.exports = new ApolloClient({})
$ npx browserify -p common-shakeify -g uglifyify test.js | wc -c
486954

This is the Apollo Client CommonJS bundle: https://unpkg.com/@apollo/[email protected]/core/core.cjs.js

tornqvist avatar Oct 30 '20 08:10 tornqvist