question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Replace uglifyjs-webpack-plugin with terser-webpack-plugin

See original GitHub issue

What problem does this feature solve?

@vue/cli is currently using uglify-es via the webpack plugin for script minification. However, regarding this comment, uglify-es is no longer actively maintained. This circumstance resulted in a fork, terser, especially to fix or at least work on the not-that-small amount of issues uglify-es had or still has (at least these).

A PR to swap out uglify-es in favor of terserresulted in a different plugin - terser-webpack-plugin.

Unless the maintenance of uglify-es surprisingly changes, I’d suggest to go with the maintained fork, especially since it has a better chance to get bugs fixed in a more reasonable amount of time.

The new plugin’s API is almost equivalent, only uglifyOptions was renamed to terserOptions.

What does the proposed API look like?

No new API; Current API unchanged as long as no one intercepts the minimizer configuration entry (it’s currently not possible to just swap out the plugin options of uglifyjs-webpack-plugin via chaining).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
yyx990803commented, Aug 16, 2018

Let’s keep this open for now, since we are not so sure about the stability of terser and how the fork itself will be maintained in the long run. Ultimately this is something uglifyjs-webpack-plugin needs to consider as well.

1reaction
smalllongcommented, Aug 16, 2018

Maybe babel-minify is a better choice?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Replace uglifyjs-webpack-plugin to terser-webpack-plugin
Description uglifyjs-webpack-plugin is deprecated, replace the plugin to terser-webpack-plugin webpack-stylish also deprecated and the ...
Read more >
terser-webpack-plugin - npm
This plugin uses terser to minify/minimize your JavaScript. Getting Started. Webpack v5 comes with the latest terser-webpack-plugin out of the ...
Read more >
UglifyjsWebpackPlugin | webpack
This plugin uses uglify-js to minify your JavaScript. Requirements. This module requires a minimum of Node v6.9.0 and Webpack v4.0.0. Getting Started.
Read more >
UglifyJS and webpack v5 - Stack Overflow
Here's an example on how to use the Terser plugin for webpack. // webpack.config.js const TerserPlugin = require("terser-webpack-plugin"); ...
Read more >
TerserWebpackPlugin | webpack 中文文档
该插件使用terser 来压缩JavaScript。 入门. webpack v5 开箱即带有最新版本的 terser-webpack-plugin 。如果你使用的是webpack v5 或更高版本,同时希望自定义配置, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found