Skip to content

Commit

Permalink
migrate to terser (related with #1832)
Browse files Browse the repository at this point in the history
  • Loading branch information
liborm85 committed Dec 27, 2020
1 parent ff360f7 commit 27d4b1c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"rewire": "^5.0.0",
"sinon": "^9.2.2",
"string-replace-webpack-plugin": "^0.1.3",
"terser-webpack-plugin": "4.2.3",
"transform-loader": "^0.2.4",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^4.44.2"
},
"engines": {
Expand Down
26 changes: 15 additions & 11 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var path = require('path');
var UglifyJsPlugin = require('uglifyjs-webpack-plugin');
var TerserPlugin = require('terser-webpack-plugin');
var StringReplacePlugin = require("string-replace-webpack-plugin");
var webpack = require('webpack');
var pkg = require('./package.json');
Expand Down Expand Up @@ -101,26 +101,30 @@ module.exports = {
},
optimization: {
minimizer: [
new UglifyJsPlugin({
new TerserPlugin({
include: /\.min\.js$/,
sourceMap: true,
uglifyOptions: {
extractComments: false,
terserOptions: {
format: {
preamble: banner,
comments: false,
},
output: {
preamble: banner,
comments: false,
},
compress: {
drop_console: true
},
mangle: {
reserved: ['HeadTable', 'NameTable', 'CmapTable', 'HheaTable', 'MaxpTable', 'HmtxTable', 'PostTable', 'OS2Table', 'LocaTable', 'GlyfTable']
}
keep_classnames: true,
keep_fnames: true
}
})
]
},
plugins: [
new StringReplacePlugin(),
new webpack.BannerPlugin({
banner: banner,
raw: true
})
new StringReplacePlugin()
],
devtool: 'source-map'
};

0 comments on commit 27d4b1c

Please # to comment.