@@ -29,19 +29,19 @@ export default function(j: IJSCodeshift, ast: INode): INode {
2929 const searchForRequirePlugin : INode = ast
3030 . find ( j . VariableDeclarator )
3131 . filter (
32- j . filters . VariableDeclarator . requiresModule ( "uglifyjs -webpack-plugin" ) ,
32+ j . filters . VariableDeclarator . requiresModule ( "terser -webpack-plugin" ) ,
3333 ) ;
3434
3535 /**
36- * Look for a variable declaration which requires uglifyjs -webpack-plugin
36+ * Look for a variable declaration which requires terser -webpack-plugin
3737 * saves the name of this variable.
3838 */
3939 searchForRequirePlugin . forEach ( ( node : INode ) : void => {
4040 pluginVariableAssignment = node . value . id . name ;
4141 } ) ;
4242
4343 pluginVariableAssignment = ! pluginVariableAssignment
44- ? "webpack.optimize.UglifyJsPlugin "
44+ ? "webpack.optimize.TerserPlugin "
4545 : pluginVariableAssignment ;
4646
4747 findPluginsByName ( j , ast , [ pluginVariableAssignment ] )
@@ -60,7 +60,7 @@ export default function(j: IJSCodeshift, ast: INode): INode {
6060 */
6161 if ( pluginOptions . length ) {
6262 /*
63- * If user is using UglifyJsPlugin directly from webpack
63+ * If user is using TerserPlugin directly from webpack
6464 * transformation must:
6565 * - remove it
6666 * - add require for uglify-webpack-plugin
@@ -70,8 +70,8 @@ export default function(j: IJSCodeshift, ast: INode): INode {
7070 // create require for uglify-webpack-plugin
7171 const pathRequire : INode = getRequire (
7272 j ,
73- "UglifyJsPlugin " ,
74- "uglifyjs -webpack-plugin" ,
73+ "TerserPlugin " ,
74+ "terser -webpack-plugin" ,
7575 ) ;
7676 // append to source code.
7777 ast
@@ -84,7 +84,7 @@ export default function(j: IJSCodeshift, ast: INode): INode {
8484 "init" ,
8585 j . identifier ( "minimizer" ) ,
8686 j . arrayExpression ( [
87- j . newExpression ( j . identifier ( "UglifyJsPlugin " ) , [ pluginOptions [ 0 ] ] ) ,
87+ j . newExpression ( j . identifier ( "TerserPlugin " ) , [ pluginOptions [ 0 ] ] ) ,
8888 ] ) ,
8989 ) ;
9090 } else {
0 commit comments