Skip to content

Commit

Permalink
feat: use terserPlugin in loaderOptionsPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
abenezerabebe authored and sendilkumarn committed Mar 16, 2019
1 parent 326f783 commit 14f5337
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Expand Up @@ -13,13 +13,13 @@ module.exports = {
exports[`loaderOptionsPlugin transforms correctly using "loaderOptionsPlugin-1" data 1`] = `
"module.exports = {
plugins: [
new webpack.optimize.UglifyJsPlugin(),
new webpack.LoaderOptionsPlugin({
new webpack.optimize.TerserPlugin(),
new webpack.LoaderOptionsPlugin({
foo: 'bar',
debug: true,
minimize: true
})
]
]
}
"
`;
Expand Down
@@ -1,9 +1,9 @@
module.exports = {
debug: true,
plugins: [
new webpack.optimize.UglifyJsPlugin(),
new webpack.LoaderOptionsPlugin({
foo: 'bar'
})
]
debug: true,
plugins: [
new webpack.optimize.TerserPlugin(),
new webpack.LoaderOptionsPlugin({
foo: 'bar'
})
]
}
4 changes: 2 additions & 2 deletions packages/migrate/loaderOptionsPlugin/loaderOptionsPlugin.ts
Expand Up @@ -37,8 +37,8 @@ export default function(j: IJSCodeshift, ast: INode): INode {
});
}

// If there is UglifyJsPlugin, set minimize: true
if (findPluginsByName(j, ast, ["webpack.optimize.UglifyJsPlugin"]).size()) {
// If there is TerserPlugin, set minimize: true
if (findPluginsByName(j, ast, ["webpack.optimize.TerserPlugin"]).size()) {
loaderOptions.minimize = true;
}

Expand Down

0 comments on commit 14f5337

Please sign in to comment.