react-app-rewire-uglifyjs
create-react-app doesn't support tree-shaking because it uses webpack's builtin uglifyjs plugin. This library will replace it with uglifyjs-webpack-plugin and enable tree shaking to your cra project!
Install
$ yarn add react-app-rewire-uglifyjs --devor$ npm install --only=dev react-app-rewire-uglifyjs
Add it to your project
- Rewire your app
- modify
config-overrides.js
const rewireUglifyjs = ; /* config-overrides.js */module { config = ; return config;}