Cleaning up, minifying, and compressing resources

Of course, excluding unused exports from bundles, also known as tree shaking, minifying scripts by cleaning up dead code and then, compressing script files, is always a good thing when it comes to JavaScript performance, especially when dealing with network latency. Amongst the very good tools that will help you do this is Webpack (https://webpack.js.org/), combined with the UglifyJS plugin (https://github.com/webpack-contrib/uglifyjs-webpack-plugin) and its compression plugin (https://github.com/webpack-contrib/compression-webpack-plugin), which will tree-shake your code, minify your script by removing any unused or dead code, and compress the resulting files.

The advantages of tree-shaking ...

Get Mastering The Faster Web with PHP, MySQL, and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.