Registry / devops / terser-webpack-plugin-legacy

terser-webpack-plugin-legacy

JSON →
library1.2.5jsnpmunverified

Terser plugin for webpack 3.x to minify JavaScript using terser. Legacy version (v1.2.5) for webpack 3, maintained separately from the main terser-webpack-plugin which targets webpack 4+. Uses terser for modern ES6+ syntax support compared to uglify-js. Limited to Node >= 6.9.0 and webpack ^3.0.0. Not recommended for new projects; use terser-webpack-plugin (non-legacy) for webpack 4+.

npm install terser-webpack-plugin-legacy
INSTALL
IMPORT
SIG · TERSER-WEBPACK-PLU
T
terser-webpack-plugin-legacy
devopsjavascriptv1.2.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TerserPlugin
const TerserPlugin = require('terser-webpack-plugin-legacy');
import TerserPlugin from 'terser-webpack-plugin-legacy';
CJS only; no default ESM export in this legacy version.
TerserPlugin (as named export)
const { TerserPlugin } = require('terser-webpack-plugin-legacy');
const { TerserPlugin } = require('terser-webpack-plugin');
Note: package name is terser-webpack-plugin-legacy, not terser-webpack-plugin. Also, it's a default export, not named.
Plugin options
new (require('terser-webpack-plugin-legacy'))({ cache: true })
new (require('terser-webpack-plugin'))({ cache: true })
Common mistake: using wrong package name. Ensure version 1.x for webpack 3.

Sets up terser-webpack-plugin-legacy in webpack 3 config with cache enabled and console removal.

const TerserPlugin = require('terser-webpack-plugin-legacy'); module.exports = { context: __dirname, entry: './src/index.js', output: { path: __dirname + '/dist', filename: 'bundle.js' }, optimization: { minimizer: [ new TerserPlugin({ test: /\.js(\?.*)?$/i, cache: true, terserOptions: { compress: { drop_console: true } } }) ] } };
Debug
Known issues
gotchaPackage name is `terser-webpack-plugin-legacy`, not `terser-webpack-plugin`. Using the wrong package will install the modern version for webpack 4+.
fix
Install `terser-webpack-plugin-legacy` and require it as shown.
affects: >=1.0.0
breakingOnly compatible with webpack ^3.0.0. Will not work with webpack 4+.
fix
Upgrade to `terser-webpack-plugin` (non-legacy) for webpack 4+.
affects: >=1.0.0
deprecatedLegacy plugin; not actively developed. Consider migrating to the non-legacy version.
fix
Use `terser-webpack-plugin` (v4+) for new projects.
affects: >=1.0.0
gotchaDefault caching to `node_modules/.cache/terser-webpack-plugin` may cause issues in CI.
fix
Set `cache: false` or a custom path to avoid permission errors.
affects: >=1.0.0
gotchaThe `sourceMap` option must be enabled in webpack config for source maps to work.
fix
Add `devtool: 'source-map'` to webpack config.
affects: >=1.0.0
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'terser-webpack-plugin'
Incorrect package name; installed the wrong package or not installed.
fix
Run: npm install terser-webpack-plugin-legacy --save-dev
TypeError: Cannot read property 'tapAsync' of undefined
Plugin incompatible with webpack 4+ because it uses webpack 3 hooks.
fix
Use terser-webpack-plugin (non-legacy) for webpack 4+.
Error: webpack.optimize.UglifyJsPlugin is not a constructor
Misunderstanding: using UglifyJsPlugin when terser plugin should be used.
fix
Use TerserPlugin from 'terser-webpack-plugin-legacy' instead.
Upgrade
Version history
1.2.5latest on npm
Audit
Dependencies
webpackrequiredpeer dependency
Agent activity
6 hits · last 30 days
node
6
Resources
terser-webpack-plugin-legacy — npm install terser-webpack-plugin-legacy · libregistry