Skip to content

Commit 09a1698

Browse files
committed
docs: list all built-in minimizers at the top of the README
Replace the brief intro with a structured overview that groups every built-in minimizer (JS, JSON, HTML) under its asset type, names the static helper, links the upstream tool, and notes which optional peer dependency to install. This makes it easy to pick the right minimizer without reading the full Examples section.
1 parent 0c5c155 commit 09a1698

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

README.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,31 @@
1313

1414
# terser-webpack-plugin
1515

16-
This plugin uses [terser](https://github.com/terser/terser) to minify/minimize your JavaScript by default, and can also minify other asset types — JSON and HTML — via built-in minimizers.
16+
This plugin minifies your assets in a webpack build. It ships with several
17+
built-in minimizers covering JavaScript, JSON, and HTML — pick one with the
18+
[`minify`](#minify) option and target the right files with [`test`](#test).
1719

18-
For HTML it can use 3 tools:
20+
JavaScript minimizers:
1921

20-
- [`html-minifier-terser`](https://github.com/terser/html-minifier-terser) — JavaScript-based HTML minifier (the default for HTML).
21-
- [`@swc/html`](https://github.com/swc-project/swc) — very fast Rust-based platform for the Web.
22-
- [`@minify-html/node`](https://github.com/wilsonzlin/minify-html) — a Rust HTML minifier, optimised for speed.
22+
- [`terser`](https://github.com/terser/terser)`TerserPlugin.terserMinify` (default). The same JavaScript-based minifier that webpack uses out of the box; produces small, well-tested output and supports the full set of `extractComments` modes.
23+
- [`uglify-js`](https://github.com/mishoo/UglifyJS)`TerserPlugin.uglifyJsMinify`. ES5-only minifier, useful when you specifically need UglifyJS-compatible output. Requires `npm install --save-dev uglify-js`.
24+
- [`@swc/core`](https://github.com/swc-project/swc)`TerserPlugin.swcMinify`. A very fast Rust-based JavaScript/TypeScript minifier. Requires `npm install --save-dev @swc/core`.
25+
- [`esbuild`](https://github.com/evanw/esbuild)`TerserPlugin.esbuildMinify`. An extremely fast JS bundler/minifier; legal comments are always preserved (no `extractComments` support). Requires `npm install --save-dev esbuild`.
26+
27+
JSON minimizer:
28+
29+
- `JSON.stringify``TerserPlugin.jsonMinify`. Built in (no extra dependency); supports `space` and `replacer` options.
30+
31+
HTML minimizers:
32+
33+
- [`html-minifier-terser`](https://github.com/terser/html-minifier-terser)`TerserPlugin.htmlMinifierTerser`. The default HTML minimizer. JavaScript-based, no native dependency. Requires `npm install --save-dev html-minifier-terser`.
34+
- [`@swc/html`](https://github.com/swc-project/swc)`TerserPlugin.swcMinifyHtml` (full HTML documents) and `TerserPlugin.swcMinifyHtmlFragment` (HTML fragments, e.g. `<template>` content). Very fast Rust-based platform for the Web. Requires `npm install --save-dev @swc/html`.
35+
- [`@minify-html/node`](https://github.com/wilsonzlin/minify-html)`TerserPlugin.minifyHtmlNode`. A Rust HTML minifier optimised for speed and effectiveness. Requires `npm install --save-dev @minify-html/node`.
36+
37+
All of the non-default minimizers are declared as **optional** peer
38+
dependencies — install only the ones you actually use. You can also stack
39+
multiple `TerserPlugin` instances in the same build to handle different
40+
file types with different minimizers (see [Examples](#examples)).
2341

2442
## Getting Started
2543

0 commit comments

Comments
 (0)