Skip to main content

Get the absolute path to the current entrypoint

还没翻译译自英文(bun.com)本页 4 段都还没译

The Bun.main property contains the absolute path to the current entrypoint.

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

The printed path is the file executed with bun run.

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

See Utils.

翻訳 © 2026 fanyi.dev · 原文 © 2026 the Bun project (LICENSE.md names no copyright holder) (MIT)