Bun.main 屬性包含當前入口點的絕對路徑。
ts
console.log(Bun.main);ts
import "./foo.ts";打印的路徑對應於使用 bun run 執行的文件。
sh
bun run index.tstxt
/path/to/index.tssh
bun run foo.tstxt
/path/to/foo.ts請參閱 文檔 > API > Utils 獲取更多有用的工具函數。