Skip to content

chore: use Node 24 LTS for binary builds + explicit tree shaking#1018

Merged
BYK merged 1 commit into
mainfrom
chore/node24-optimizations
May 23, 2026
Merged

chore: use Node 24 LTS for binary builds + explicit tree shaking#1018
BYK merged 1 commit into
mainfrom
chore/node24-optimizations

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented May 23, 2026

Changes

  • Bump fossilize NODE_VERSION from "22" to "lts" (resolves to Node 24 Krypton)
  • Add explicit treeShaking: true to both build.ts and bundle.ts esbuild configs
  • Update esbuild target from node22 to node24

Results (linux-x64 with code cache)

Metric Node 22 Node 24 LTS Change
JS bundle 3.9 MiB 3.7 MiB -5%
Raw binary 127 MiB 125 MiB -1.6%
Startup ~1.0s ~1.0s on par
Completion ~0.18s ~0.15s ~17% faster

Note: Earlier measurements showed larger startup improvements but were affected by system load variance. Controlled re-measurement shows startup is comparable, with completions genuinely faster.

Note: engines.node in package.json stays at >=22.15 — that's the minimum for the npm package (npx sentry). The binary embeds its own Node 24 runtime.

- Bump fossilize NODE_VERSION from '22' to 'lts' (resolves to Node 24)
- Add explicit treeShaking: true to esbuild configs
- Update esbuild target from node22 to node24

Results (linux-x64 with code cache):
  Binary size:  127 MiB → 125 MiB (-1.6%)
  JS bundle:    3.9 MiB → 3.7 MiB (-5%)
  --version:    ~1.7s → ~1.0s (~41% faster)
  completion:   ~0.3s → ~0.16s (~47% faster)

Node 24 LTS (Krypton) has V8 12.x with faster compilation and
better code cache utilization, explaining the startup improvement.
Comment thread script/bundle.ts
sourcemap: true,
platform: "node",
target: "node22",
target: "node24",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Library bundle targets node24 but package engines allows Node 22

Setting target: "node24" in the npm library bundle (dist/index.cjs) tells esbuild to skip downleveling any syntax that Node 24 supports natively; if any such syntax is used in source or dependencies, it will be emitted verbatim and break consumers running Node 22 (permitted by engines.node >= 22.15).

Evidence
  • bundle.ts line 197 changes target from "node22" to "node24" for the output dist/index.cjs, which is the npm library entry point.
  • package.json engines.node remains ">=22.15", explicitly allowing Node 22 consumers of the npm package.
  • esbuild's target determines which syntax transformations are skipped; a node24-only syntax feature in source or a bundled dep will pass through untransformed.
  • The binary build (build.ts) also uses node24 but embeds its own Node 24 runtime (via fossilize), so that path is safe — the library bundle path is not.
  • The PR description acknowledges the binary embeds Node 24, but does not address this library-bundle target mismatch.

Suggested fix: Keep the library bundle target aligned with the minimum supported engine version so esbuild correctly downlevels any syntax gaps.

Suggested change
target: "node24",
target: "node22",

Identified by Warden find-bugs · 89U-MM4

@github-actions
Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 4286 uncovered lines.


Generated by Codecov Action

@BYK BYK merged commit e6793c5 into main May 23, 2026
26 checks passed
@BYK BYK deleted the chore/node24-optimizations branch May 23, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant