From 0145343b2451ea2b575157a45c9b77424d060a12 Mon Sep 17 00:00:00 2001 From: Ashesh Vashi Date: Fri, 22 May 2026 14:25:22 +0530 Subject: [PATCH] build(mac): bump webpack heap to 6 GB on the macOS appbundle build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit macOS x64 appbundle builds keep dying inside webpack's TerserPlugin at 92% (asset processing). Build #1294 on `pgabf-macos-x64` reached ` [webpack.Progress] 92% [0] sealing asset processing TerserPlugin` and was killed without producing a V8 fatal-error preamble, which points at the OS reaping the Node process under memory pressure rather than V8 hitting its own heap ceiling. TerserPlugin is already running single-threaded (see web/webpack.config.js, `parallel: false`), so we can't claw memory back by reducing parallelism. Bump the V8 old-space ceiling from 3072 MB to 6144 MB inside the macOS appbundle build only — the helper in pkg/mac/build-functions.sh bypasses `yarn run bundle` and calls `yarn run webpacker` directly (see commit d96e8634), so this knob is independent of the npm script and does not affect linux/pip/Makefile or dev-machine builds. They keep the 3 GB the `bundle` script has been shipping with for years. If this still doesn't get the x64 box past Terser we'll switch the minimiser to esbuild via terser-webpack-plugin's `minify` option; that is a larger and more invasive change so we are trying the cheap fix first. --- pkg/mac/build-functions.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/mac/build-functions.sh b/pkg/mac/build-functions.sh index de0f89318a7..9a9dca61031 100644 --- a/pkg/mac/build-functions.sh +++ b/pkg/mac/build-functions.sh @@ -305,10 +305,14 @@ _complete_bundle() { # stderr into stdout, so a crash inside lint/webpack (e.g. an OOM # kill or native-module load failure) leaves a trace in the # Jenkins console instead of an empty gap before the trap fires. - # Env vars match the top-level "bundle" npm script (see web/package.json) - # so behavior is identical to `yarn run bundle`. + # NODE_ENV mirrors the top-level "bundle" npm script (see + # web/package.json). NODE_OPTIONS bumps V8's old-space ceiling + # past the 3 GB default the npm script uses: the macOS x64 builder + # OS-OOM-kills webpack inside TerserPlugin at the 3 GB setting + # (build #1294, sealing asset processing at 92%). Other build + # paths still get 3 GB via the npm script. export NODE_ENV=production - export NODE_OPTIONS=--max-old-space-size=3072 + export NODE_OPTIONS=--max-old-space-size=6144 echo "==> Running ESLint..." yarn run linter 2>&1 echo "==> Running webpack bundle..."