Skip to content

chore(build): bump esbuild target to node25#1216

Merged
John-David Dalton (jdalton) merged 2 commits intomainfrom
chore/esbuild-target-node24
Apr 17, 2026
Merged

chore(build): bump esbuild target to node25#1216
John-David Dalton (jdalton) merged 2 commits intomainfrom
chore/esbuild-target-node24

Conversation

@jdalton
Copy link
Copy Markdown
Contributor

@jdalton John-David Dalton (jdalton) commented Apr 17, 2026

Summary

  • Bumps the target in the CLI and shared index bundlers from 'node18' to 'node25' to match what we actually ship and run (.node-version = 25.9.0).

Why

The prior 'node18' target meant esbuild was still lowering modern syntax that's been native for years. Matching the runtime we target removes unnecessary transforms and keeps the bundle honest about the runtime floor.

Test plan

  • pnpm run type green
  • pnpm run build:cli succeeds
  • Confirmed esbuild 0.25.11 accepts node25 as a target
  • CI green

Note

Medium Risk
Build output will now assume Node 25 features; if any environments still run the generated CLI on older Node versions, bundles may fail at runtime. The change also centralizes shared esbuild options, so misconfiguration could affect both the CLI bundle and index loader builds.

Overview
Updates the Socket CLI esbuild setup to target node25 and centralizes shared bundler settings in a new createBaseConfig() helper.

esbuild.cli.mts and createIndexConfig() now spread this base config (shared define, CJS format, no sourcemaps/minify, write: false), reducing drift between bundles while keeping CLI-specific banner/defines/plugins on top.

Reviewed by Cursor Bugbot for commit bbc0a47. Configure here.

@jdalton
Copy link
Copy Markdown
Contributor Author

Cursor (@cursor) review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit bbc0a47. Configure here.

Comment thread packages/cli/scripts/esbuild-utils.mts
@jdalton

This comment was marked as resolved.

Updates the hardcoded esbuild `target` in the two prod build configs
(cli.mts and esbuild-utils.mts) from 'node18' to 'node25' so the
output matches what we actually ship and run (see .node-version).

No runtime behavior change; just unlocks the newer syntax lowering
defaults in esbuild so the bundle doesn't carry transforms for
language features that are already native in node 18+.
Introduces `createBaseConfig(inlinedEnvVars)` in esbuild-utils.mts
that returns the settings every Socket CLI esbuild config needs to
agree on:

  bundle, format, minify, platform, sourcemap, target, write,
  define: { 'process.env.NODE_ENV': '"production"', ...inlined }

Both callers spread it and add their variant-specific fields:
  * `createIndexConfig` (index loader): banner + entry + output +
    env-var replacement plugin.
  * `esbuild.cli.mts` (main bundle): shebang+importMeta banner,
    extra `import.meta.url` define, `keepNames`, `loader`,
    `logOverride`, `metafile`, plugin stack.

Before: the Node target and six other shared settings were duplicated
between the two configs, so bumping something like `target: 'node25'`
meant remembering to touch both files (and earlier PRs did miss
exactly that pattern).

No behavior change — diffed the build output before/after.
@jdalton John-David Dalton (jdalton) merged commit 691cc07 into main Apr 17, 2026
13 checks passed
@jdalton John-David Dalton (jdalton) deleted the chore/esbuild-target-node24 branch April 17, 2026 21:55
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.

2 participants