To be honest, optimising a Webpack bundle is probably one of the most annoying things I have to do as a Software Engineer.
Some resources to help you with it:
Tools:
- webpack-module-analyser
- To understand why something is being bundled:
whybundled
npm package. This requires generating Webpack stats withwebpack-stats-plugin
. - To debug production deployments:
npx bundle-wizard https://example.com
- Chrome DevTools Coverage: useful to know how bad your code coverage usage is.
Good luck with this not-so-nice-but-quite-important task!