Use Webpack's default minifier

This commit is contained in:
Jordan Eldredge 2018-11-19 20:08:20 -08:00
parent f1047ae33c
commit aaf78f558b
4 changed files with 10 additions and 27 deletions

View file

@ -1,6 +1,6 @@
const path = require("path");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const UnminifiedWebpackPlugin = require("unminified-webpack-plugin");
module.exports = {
mode: "production",
@ -50,26 +50,16 @@ module.exports = {
reportFilename: "library-report.html",
openAnalyzer: false
}),
new UglifyJsPlugin({
include: /\.min\.js$/,
parallel: true,
uglifyOptions: {
compress: {
// Workaround: https://github.com/mishoo/UglifyJS2/issues/2842
inline: false
}
}
})
// Also generate non-minified bundles.
new UnminifiedWebpackPlugin()
],
performance: {
// We do some crazy shit okay! Don't judge!
maxEntrypointSize: 900000,
maxAssetSize: 900000
maxEntrypointSize: 9000000,
maxAssetSize: 9000000
},
entry: {
bundle: "./js/webamp.js",
"bundle.min": "./js/webamp.js",
"lazy-bundle": "./js/webampLazy.tsx",
"lazy-bundle.min": "./js/webampLazy.tsx"
},
output: {

View file

@ -2,7 +2,6 @@ const webpack = require("webpack");
const merge = require("webpack-merge");
const workboxPlugin = require("workbox-webpack-plugin");
const GitRevisionPlugin = require("git-revision-webpack-plugin");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const common = require("./webpack.common.js");
@ -24,17 +23,6 @@ const config = merge(common, {
),
COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash())
}),
new UglifyJsPlugin({
// TODO: Is this needed with the devtool setting above?
sourceMap: true,
parallel: true,
uglifyOptions: {
compress: {
// Workaround: https://github.com/mishoo/UglifyJS2/issues/2842
inline: false
}
}
}),
new workboxPlugin.GenerateSW({
swDest: "service-worker.js",
// importWorkboxFrom: "local",

View file

@ -121,6 +121,7 @@
"travis-weigh-in": "^1.0.2",
"typescript": "^3.0.1",
"uglifyjs-webpack-plugin": "^1.2.5",
"unminified-webpack-plugin": "^2.0.0",
"url-loader": "^1.1.2",
"webpack": "^4.26.0",
"webpack-bundle-analyzer": "^3.0.3",

View file

@ -8636,6 +8636,10 @@ universalify@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7"
unminified-webpack-plugin@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/unminified-webpack-plugin/-/unminified-webpack-plugin-2.0.0.tgz#9cd9c3f420003e968d6ed5ea365085be5e72df14"
unpipe@1.0.0, unpipe@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"