File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- // used by esbuild-node.sh
1+ // This script bundles files matching *.node.[js|cjs|mjs] using esbuild.
2+ // The list of files to process is passed as a text file path in the first argument.
3+ //
4+ // WHY THIS SCRIPT EXISTS:
5+ // Raw esbuild typically outputs .js files. However, for Node.js scripts,
6+ // the extension (.cjs or .mjs) is critical for correct module resolution.
7+ //
8+ // Example Transformation:
9+ // Input: ./pages/bash/xx/xx.node.cjs
10+ // Esbuild: outputs ./pages/bash/xx/xx.node.bundled.gitignored.js
11+ // Script: copies .js to ./pages/bash/xx/xx.node.bundled.gitignored.cjs
12+ // (Note: This results in TWO files: the .js bundle and the .cjs copy)
13+ //
14+ // Without this script, Node.js might fail to run the bundle if it misinterprets
15+ // the module type (ESM vs CJS). This script keeps the target extension in sync.
16+ //
17+ // Usage:
18+ // node esbuild-node.js var/esbuild.txt
19+ // node esbuild-node.js var/esbuild.txt --watch
20+ //
21+ // Typically called by: /bin/bash esbuild-node.sh [watch]
22+
223
324import * as esbuild from "esbuild" ;
425
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ cat <<EEE
3232 server:
3333 http://\${LOCAL_HOSTS}:\${NODE_API_PORT}
3434
35+ Warning:
36+ Generally this project uses pnpm
37+
3538EEE
3639
3740 ` ,
You can’t perform that action at this time.
0 commit comments