Skip to content

Commit 81b6dd3

Browse files
committed
docs(en): fetch all
1 parent 53f037e commit 81b6dd3

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

src/content/plugins/terser-webpack-plugin.mdx

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -683,24 +683,39 @@ module.exports = {
683683
With built-in minify functions:
684684

685685
```ts
686-
import type { SwcMinifyFunction } from "terser-webpack-plugin";
686+
import type { JsMinifyOptions as SwcOptions } from "@swc/core";
687+
import type { MinifyOptions as UglifyJSOptions } from "uglify-js";
688+
import type { TransformOptions as EsbuildOptions } from "esbuild";
689+
import type { MinifyOptions as TerserOptions } from "terser";
687690

688691
module.exports = {
689692
optimization: {
690693
minimize: true,
691694
minimizer: [
692-
new TerserPlugin<SwcMinimizer>({
695+
new TerserPlugin<SwcOptions>({
693696
minify: TerserPlugin.swcMinify,
694697
terserOptions: {
695-
compress: true,
698+
// `swc` options
699+
},
700+
}),
701+
new TerserPlugin<UglifyJSOptions>({
702+
minify: TerserPlugin.uglifyJsMinify,
703+
terserOptions: {
704+
// `uglif-js` options
705+
},
706+
}),
707+
new TerserPlugin<EsbuildOptions>({
708+
minify: TerserPlugin.esbuildMinify,
709+
terserOptions: {
710+
// `esbuild` options
696711
},
697712
}),
698713

699-
// Alternative:
700-
new TerserPlugin<typeof TerserPlugin.swcMinify>({
701-
minify: TerserPlugin.swcMinify,
714+
// Alternative usage:
715+
new TerserPlugin<TerserOptions>({
716+
minify: TerserPlugin.terserMinify,
702717
terserOptions: {
703-
compress: true,
718+
// `terser` options
704719
},
705720
}),
706721
],

0 commit comments

Comments
 (0)