Skip to content

Commit

Permalink
feat: replace Uglify with Terser in generators
Browse files Browse the repository at this point in the history
  • Loading branch information
abenezerabebe authored and sendilkumarn committed Mar 16, 2019
1 parent 799577d commit 2b8651b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions packages/generators/init-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class InitGenerator extends Generator {
this.dependencies = [
"webpack",
"webpack-cli",
"uglifyjs-webpack-plugin",
"terser-webpack-plugin",
"babel-plugin-syntax-dynamic-import",
];
this.configuration = {
Expand Down Expand Up @@ -430,12 +430,12 @@ export default class InitGenerator extends Generator {
public installPlugins() {
if (this.isProd) {
this.dependencies = this.dependencies.filter(
(p: string) => p !== "uglifyjs-webpack-plugin",
(p: string) => p !== "terser-webpack-plugin",
);
} else {
this.configuration.config.topScope.push(
tooltip.uglify(),
"const UglifyJSPlugin = require('uglifyjs-webpack-plugin');",
tooltip.terser(),
"const TerserPlugin = require('terser-webpack-plugin');",
"\n",
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/generators/utils/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* Callable function with the initial plugins
*
* @returns {Function} An function that returns an array
* that consists of the uglify plugin
* that consists of the terser plugin
*/

export default function(_?: void): string[] {
return ["new UglifyJSPlugin()"];
return ["new TerserPlugin()"];
}
6 changes: 3 additions & 3 deletions packages/generators/utils/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ export default {
*/`;
},

uglify: (_?: void): string => {
terser: (_?: void): string => {
return `/*
* We've enabled UglifyJSPlugin for you! This minifies your app
* We've enabled TerserJSPlugin for you! This minifies your app
* in order to load faster and run less javascript.
*
* https://github.com/webpack-contrib/uglifyjs-webpack-plugin
* https://github.com/webpack-contrib/terser-webpack-plugin
*
*/`;
},
Expand Down

0 comments on commit 2b8651b

Please sign in to comment.