webpack: Use Webpack’s mode option rather than repurposing env.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-09-25 21:32:14 -07:00 committed by Tim Abbott
parent f628282c9e
commit f644bf2063
2 changed files with 4 additions and 5 deletions

View File

@ -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)

View File

@ -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",