terser-webpack-plugin
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@jridgewell/trace-mapping | 0.3.22 | 35.61 kB | MIT | prod | |
jest-worker | 27.5.1 | 18.95 kB | MIT | prod | |
schema-utils | 3.3.0 | 17.93 kB | MIT | prod | |
serialize-javascript | 6.0.2 | 6.19 kB | BSD-3-Clause | prod | |
terser | 5.27.1 | 2.03 MB | BSD-2-Clause | prod | |
webpack | 5.90.2 | 4.59 MB | MIT | prod peer | 1 1 |
The terser-webpack-plugin is a JavaScript minimization plugin for webpack. It utilizes terser to minimize your JavaScript code.
To use terser-webpack-plugin, you first need to install it using npm, yarn, or pnpm like this:
npm install terser-webpack-plugin --save-dev
yarn add -D terser-webpack-plugin
pnpm add -D terser-webpack-plugin
Then, include the terser-webpack-plugin in your webpack
config like this:
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
};
Finally, run webpack
using the method you prefer. The plugin also supports various configurations such as test
, include
, exclude
, parallel
, minify
, terserOptions
, and extractComments
.
The terser-webpack-plugin documentation is available on GitHub. The documentation provides a detailed explanation of the plugin's installation process, usage, options, and examples. It also furnishes guidelines on how to contribute to the project.