Skip to content

Commit 4f9a607

Browse files
refactor(bundles): Migrate from uglify to terser (#3813)
1 parent e4991a5 commit 4f9a607

File tree

3 files changed

+430
-417
lines changed

3 files changed

+430
-417
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@
9494
"lodash": "^4.17.15",
9595
"prettier": "^2.0.5",
9696
"pretty-quick": "^2.0.1",
97-
"rollup": "^1.27.14",
97+
"rollup": "^2.22.1",
9898
"rollup-plugin-node-resolve": "^5.2.0",
99-
"rollup-plugin-sourcemaps": "^0.5.0",
100-
"rollup-plugin-uglify": "^6.0.4",
99+
"rollup-plugin-sourcemaps": "^0.6.2",
100+
"rollup-plugin-terser": "^6.1.0",
101101
"ts-jest": "^26.0.0",
102102
"tslint": "5.20.1",
103103
"tslint-eslint-rules": "^5.4.0",

rollup.config.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import nodeResolve from 'rollup-plugin-node-resolve';
2-
import { uglify } from 'rollup-plugin-uglify';
2+
import { terser } from 'rollup-plugin-terser';
33
import sourcemaps from 'rollup-plugin-sourcemaps';
44

55
const MINIFY = process.env.MINIFY;
@@ -27,9 +27,9 @@ banner += `
2727
* @license MIT License, http://www.opensource.org/licenses/MIT
2828
*/`;
2929

30-
const uglifyOpts = { output: {} };
30+
const terserOpts = { output: {} };
3131
// retain multiline comment with @license
32-
uglifyOpts.output.comments = (node, comment) => comment.type === 'comment2' && /@license/i.test(comment.value);
32+
terserOpts.output.comments = (node, comment) => comment.type === 'comment2' && /@license/i.test(comment.value);
3333

3434
const onwarn = (warning) => {
3535
// Suppress this error message... https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined
@@ -41,7 +41,7 @@ const onwarn = (warning) => {
4141

4242
const plugins = [nodeResolve({ jsnext: true }), sourcemaps()];
4343

44-
if (MINIFY) plugins.push(uglify(uglifyOpts));
44+
if (MINIFY) plugins.push(terser(terserOpts));
4545

4646
const extension = MINIFY ? '.min.js' : '.js';
4747

0 commit comments

Comments
 (0)