terser-loader is a webpack loader that minifies JavaScript using Terser, a modern ES6+ capable minifier. Version 2.0.3 is the latest stable release, with peer dependency on webpack ^4 || ^5. It offers options like `terserOptions` passed directly to Terser API and `stripTrailingSemicolon`. Unlike the official `terser-webpack-plugin`, this is a loader (not a plugin) integrated in webpack's module rules pipeline, useful for selective minification alongside other loaders. Low release cadence but functional for specific use cases.
npm install terser-loaderVerified import paths — ran on the pinned version, not inferred.
Configures terser-loader to minify all .js files, removing console.log and trailing semicolons. Use in production builds.
If you need bundle-level minification, use terser-webpack-plugin instead.
Upgrade webpack to ^4 || ^5, or stick to terser-loader@1 for webpack 3.
Use terserOptions.output.semicolon = false instead.
Install terser as a dev dependency: npm install --save-dev terser
Check terserOptions for valid Terser options; do not use options like 'output' directly on the loader.
Upgrade webpack to version 4 or 5, or install terser-loader@1