Home

Awesome

Awesome Webpack Perf Awesome

A curated list of webpack tools and plugins that help make the web faster

Contents

Built-in stuff

JS minifiers

JS minifiers are tools that make JS payloads smaller.

CSS

Minifiers

CSS minifiers are tools that make the volume of CSS smaller.

There’re three popular competing CSS minifiers: CSSO, CSS Nano and Clean CSS. They’re mostly similar in the compression quality and supported features, so if you’re picking one, just choose the one you prefer more.

Other optimizers

Extraction plugins

By default (with a simple style-loader), all styles imported in the app are added into the JS bundle. CSS extraction plugins help to move these styles into a separate .css file – which helps with faster rendering and better caching.

Critical CSS plugins

Critical CSS is an approach for rendering the site faster. With Critical CSS, for each page, you extract the rules needed for the initial render and inline them. Then, you load the remaining styles asynchronously. More details

CSS-in-JS

Minification

CSS-in-JS libraries typically provide Critical CSS support out of the box and need fewer manual optimizations. However, they still need minification.

Zero-runtime libraries

Most CSS-in-JS libraries ship with a runtime – a chunk of JavaScript that runs in the browser and makes the library work. That makes them easy to use but brings noticeable performance costs.

However, there’re also several CSS-in-JS libraries that don’t use a runtime and don’t suffer from worse performance. They rely on build-time transformations instead:

Images

Image compression tools: universal

All the tools below optimize .png, .jpg, .gif and .svg images. They’re based on imagemin and imagemin plugins, so they typically result in a similar level of compression.

Pick plugins over loaders. Plugins will optimize images that were produced by other loaders or plugins, whereas loaders will only trigger for files from your source code.

Image compression tools: for a single format

The below tools focus on a specific format of images.

Other tools

Fonts

Gzip/Brotli

Gzip/Brotli compressors compress text so it’s smaller when served over the network.

Normally, this is done by a server like Apache or Nginx on runtime; but you might want to pre-build compressed assets to save the runtime cost.

Service workers

<link rel> and <script async>

<small>¹ Asynchronous chunks are chunks that are created when you use import().</small>

Prerendering

Prerendering tools run an app during the build and return the HTML the app generates. This is an alternative to server-side rendering and helps to deliver the content to the user immediately – instead of making them wait until the bundle is loaded.

Progressive web apps (PWA)

Analysis tools

Bundle contents

The following tools show relative sizes of all bundled modules. Use them to figure out what takes so much size and can be removed:

Code duplicates

These tools help to find and remove duplicated code inside the bundles:

Various tools

Webpack build performance

The following tools show how to optimize your webpack build speed.

<sup>(Animation credits: speed-measure-webpack-plugin)</sup>

Other web performance lists

Contribute

Contributions welcome! Read the contribution guidelines first.

License

CC0

To the extent possible under law, Ivan Akulov has waived all copyright and related or neighboring rights to this work.