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 > 工具 了解更多的实用工具。