Skip to content

Commit

Permalink
chore: replace UglifyJs plugin by terser plugin
Browse files Browse the repository at this point in the history
Replace "add-module-exports" Babel plugin by Webpack libraryExport.
  • Loading branch information
kslimani committed Feb 28, 2020
1 parent f630346 commit 9bbe01a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
5 changes: 1 addition & 4 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@
"modules": "commonjs",
"corejs": "3",
"useBuiltIns": "usage"
}]],
"plugins": [
"add-module-exports"
]
}]]
}
14 changes: 4 additions & 10 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Webpack 4 configuration
const path = require('path')
const webpack = require('webpack')
const UglifyJsPlugin = require("uglifyjs-webpack-plugin")
const TerserPlugin = require('terser-webpack-plugin');
const NotifierPlugin = require('webpack-build-notifier')

var name = 'ima-ad-player'
Expand All @@ -10,14 +9,8 @@ var outputFile, plugins = [], optimization = {}
if (process.env.npm_lifecycle_event === 'dist') {
outputFile = name + '.min.js'
optimization.minimizer = [
new UglifyJsPlugin({
cache: true,
parallel: true,
uglifyOptions: {
output: {
comments: false,
},
}
new TerserPlugin({
cache: true, // TODO: set to false if Webpack upgraded to 5.x ?
}),
]
} else {
Expand All @@ -35,6 +28,7 @@ module.exports = {
path: path.resolve(__dirname, 'dist'),
filename: outputFile,
library: 'ImaAdPlayer',
libraryExport: 'default',
libraryTarget: 'umd',
},
optimization: optimization,
Expand Down

0 comments on commit 9bbe01a

Please sign in to comment.