Skip to content

Commit 5e08c8f

Browse files
committed
refactor(build): align esbuild config with socket-sdk-js standards
- Change target from node20 to node18 for consistency with SDK - Remove redundant builtinModules externalization - Add comments explaining platform: 'node' auto-externalizes built-ins - Add descriptive comments for platform and target settings
1 parent 33c9e66 commit 5e08c8f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/cli/.config/esbuild.cli.build.mjs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { build } from 'esbuild'
88
import { execSync } from 'node:child_process'
99
import { randomUUID } from 'node:crypto'
1010
import { existsSync, readFileSync } from 'node:fs'
11-
import { builtinModules } from 'node:module'
1211
import path from 'node:path'
1312
import { fileURLToPath } from 'node:url'
1413

@@ -102,12 +101,16 @@ const config = {
102101
entryPoints: [path.join(rootPath, 'src/cli-dispatch.mts')],
103102
bundle: true,
104103
outfile: path.join(rootPath, 'dist/cli.js'),
104+
// Target Node.js environment (not browser).
105105
platform: 'node',
106-
target: 'node20',
106+
// Target Node.js 18+ features.
107+
target: 'node18',
107108
format: 'cjs',
108109

109-
// Externalize Node.js built-ins.
110-
external: [...builtinModules, ...builtinModules.map(m => `node:${m}`)],
110+
// With platform: 'node', esbuild automatically externalizes all Node.js
111+
// built-ins. The explicit external array with builtinModules is redundant
112+
// (but doesn't hurt as extra safety).
113+
external: [],
111114

112115
// Add shebang.
113116
banner: {

0 commit comments

Comments
 (0)