バイナリ生成手順(v20.0) https://nodejs.org/docs/latest-v20.x/api/single-executable-applications.html Node.jsランタイムを 作業ディレクトリにコピー ランタイムの電子署名を削除 (Windows / macOS) hell.jsを 注入用のブロブに変換 ブロブをランタイムに注入 注入したランタイムに電子署名を付加 (Windows / macOS) $ ./hell hell word (node:66827) ExperimentalWarning: Single executable application is an experimental feature and might change at any time (Use `hell --trace-warnings ...` to show where the warning was created) 地獄の言葉が表示された!!
実行結果 $ ./sea-example (node:82154) ExperimentalWarning: Single executable application is an experimental feature and might change at any time (Use `sea-example --trace-warnings ...` to show where the warning was created) $ curl http://localhost:3000 {"hell":"word"} サーバ側 クライアント側 地獄の言葉が返ってきた!!
実行結果 $ ./sea-example (node:82154) ExperimentalWarning: Single executable application is an experimental feature and might change at any time (Use `sea-example --trace-warnings ...` to show where the warning was created) $ curl http://localhost:3000 {"hell":"word"} サーバ側 クライアント側 地獄の言葉が返ってきた!! 本当に単一ファイル? ● バイナリだけを他のマシンに移動 しても実行できた ● ≒他の依存ファイルはなさそう