build(mac): bump webpack heap to 6 GB on the macOS appbundle build (#9967)

macOS x64 appbundle builds keep dying inside webpack's TerserPlugin at
92% (asset processing). Build #1294 on `pgabf-macos-x64` reached
`<s> [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.
This commit is contained in:
Ashesh Vashi
2026-05-22 14:43:58 +05:30
committed by GitHub
parent d96e86345e
commit 3e1921dcd9
+7 -3
View File
@@ -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..."