webpack: Run with node --experimental-strip-types.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2024-11-12 15:36:33 -08:00
committed by Tim Abbott
parent a70babaec4
commit 45de69465a
3 changed files with 36 additions and 28 deletions

View File

@@ -13,6 +13,13 @@ os.chdir(os.path.join(os.path.dirname(__file__), "../web"))
from version import ZULIP_VERSION
webpack_command = [
"node",
"--experimental-strip-types",
"--no-warnings=ExperimentalWarning",
"../node_modules/webpack-cli/bin/cli.js",
]
def build_for_prod_or_puppeteer(quiet: bool, config_name: str | None = None) -> NoReturn:
"""Builds for production, writing the output to disk"""
@@ -21,7 +28,8 @@ def build_for_prod_or_puppeteer(quiet: bool, config_name: str | None = None) ->
if int(next(meminfo).split()[1]) < 3 * 1024 * 1024:
os.environ["NODE_OPTIONS"] = "--max-old-space-size=1536"
webpack_args = [
"../node_modules/.bin/webpack-cli",
*webpack_command,
"build",
"--mode=production",
f"--env=ZULIP_VERSION={ZULIP_VERSION}",
]
@@ -45,8 +53,9 @@ def build_for_dev_server(host: str, port: str, minify: bool, disable_host_check:
# This is our most dynamic configuration, which we use for our
# dev server. The key piece here is that we identify changes to
# files as devs make edits and serve new assets on the fly.
webpack_args = ["../node_modules/.bin/webpack-cli", "serve"]
webpack_args += [
webpack_args = [
*webpack_command,
"serve",
# webpack-cli has a bug where it ignores --watch-poll with
# multi-config, and we don't need the katex part anyway.
"--config-name=frontend",