Skip to main content
Bun.main 属性包含当前入口文件的绝对路径。
console.log(Bun.main);

打印出的路径对应于使用 bun run 执行的文件。
terminal
bun run index.ts
/path/to/index.ts
terminal
bun run foo.ts
/path/to/foo.ts

更多实用工具请参见 文档 > API > 工具