webpack: Fix run-dev.py --minify.

‘--optimize-minimize’ no longer exists.  (Webpack 5 has
‘--optimization-minimize’.)

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-06-10 13:13:56 -07:00 committed by Anders Kaseorg
parent 17fe09bb6d
commit 9f3d1fdbdb
2 changed files with 3 additions and 2 deletions

View File

@ -38,7 +38,7 @@ def build_for_dev_server(host: str, port: str, minify: bool, disable_host_check:
"--hot",
]
if minify:
webpack_args.append("--optimize-minimize")
webpack_args.append("--env=minimize")
if disable_host_check:
webpack_args.append("--disable-host-check")

View File

@ -20,7 +20,7 @@ const cacheLoader: webpack.RuleSetUseItem = {
},
};
export default (_env: unknown, argv: {mode?: string}): webpack.Configuration[] => {
export default (env: {minimize?: boolean} = {}, argv: {mode?: string}): webpack.Configuration[] => {
const production: boolean = argv.mode === "production";
const config: webpack.Configuration = {
@ -177,6 +177,7 @@ export default (_env: unknown, argv: {mode?: string}): webpack.Configuration[] =
// the source snippets with the eval-* options.
devtool: production ? "source-map" : "cheap-module-source-map",
optimization: {
minimize: env.minimize ?? production,
minimizer: [
new CssMinimizerPlugin({
sourceMap: true,