Skip to content

Commit d89b68e

Browse files
committed
fix(cli): suppress esbuild warnings in CLI build
Fixed two esbuild warnings: 1. commonjs-variable-in-esm - Intentional CommonJS compatibility code 2. require-resolve-not-external - node-gyp marked as external Changes: - Added node-gyp to external array (for runtime require.resolve) - Added logOverride to silence commonjs-variable-in-esm warning The CommonJS exports in config.mts and flags.mts are intentional for compatibility when files are require()'d at runtime. The warnings were harmless but noisy. node-gyp must be external because getNmNodeGypPath() uses require.resolve('node-gyp/package.json') to locate the user's installed node-gyp at runtime, not bundle it.
1 parent 08474bc commit d89b68e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,14 @@ const config = {
110110
// With platform: 'node', esbuild automatically externalizes all Node.js
111111
// built-ins. The explicit external array with builtinModules is redundant
112112
// (but doesn't hurt as extra safety).
113-
external: [],
113+
external: [
114+
'node-gyp', // Required for require.resolve('node-gyp/package.json')
115+
],
116+
117+
// Suppress warnings for intentional CommonJS compatibility code.
118+
logOverride: {
119+
'commonjs-variable-in-esm': 'silent',
120+
},
114121

115122
// Add shebang.
116123
banner: {

0 commit comments

Comments
 (0)