獲取當前入口檔案的絕對路徑
Bun.main 屬性包含當前入口檔案的絕對路徑。
console.log(Bun.main);
import "./foo.ts";
打印出的路徑是使用 bun run 執行的檔案。
terminal
bun run index.ts
Text
/path/to/index.ts
terminal
bun run foo.ts
Text
/path/to/foo.ts
參見 Utils。
Bun.main 屬性包含當前入口檔案的絕對路徑。
console.log(Bun.main);
import "./foo.ts";
打印出的路徑是使用 bun run 執行的檔案。
bun run index.ts
/path/to/index.ts
bun run foo.ts
/path/to/foo.ts
參見 Utils。