Skip to content

Bun.main プロパティには、現在のエントリーポイントへの絶対パスが含まれています。

ts
console.log(Bun.main);
ts
import "./foo.ts";

出力されるパスは bun run で実行されたファイルに対応します。

sh
bun run index.ts
txt
/path/to/index.ts
sh
bun run foo.ts
txt
/path/to/foo.ts

さらに便利なユーティリティについては、ドキュメント > API > ユーティリティ を参照してください。

Bun by www.bunjs.com.cn 編集