From f644bf20638f48b6288c1c4d6e770136937f130e Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 25 Sep 2020 21:32:14 -0700 Subject: [PATCH] =?UTF-8?q?webpack:=20Use=20Webpack=E2=80=99s=20mode=20opt?= =?UTF-8?q?ion=20rather=20than=20repurposing=20env.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Anders Kaseorg --- tools/webpack | 4 +--- webpack.config.ts | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/webpack b/tools/webpack index 18891489ca..7a4c9618b4 100755 --- a/tools/webpack +++ b/tools/webpack @@ -12,9 +12,7 @@ STATIC_PATH = 'static/' def build_for_prod_or_puppeteer(quiet: bool) -> NoReturn: """Builds for production, writing the output to disk""" - webpack_args = ['node', 'node_modules/.bin/webpack-cli', - '-p', - '--env=production'] + webpack_args = ['node', 'node_modules/.bin/webpack-cli', '-p'] if quiet: webpack_args.append('--display=errors-only') os.execvp(webpack_args[0], webpack_args) diff --git a/webpack.config.ts b/webpack.config.ts index 269af93957..0ff907b1bf 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -20,8 +20,9 @@ const cacheLoader: webpack.RuleSetUseItem = { }, }; -export default (env?: string): webpack.Configuration[] => { - const production: boolean = env === "production"; +export default (_env: unknown, argv: {mode?: string}): webpack.Configuration[] => { + const production: boolean = argv.mode === "production"; + const config: webpack.Configuration = { name: "frontend", mode: production ? "production" : "development",