# Bun Check if the current file is the entrypoint

> Check if the current file is the entrypoint

- Skill: `jarle/bun-check-if-the-current-file-is-the-entrypoint` (Agent Skill)
- Install (CLI): `npx skillmds@latest add jarle/bun-check-if-the-current-file-is-the-entrypoint`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jarle/bun-check-if-the-current-file-is-the-entrypoint/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: jarle (https://skillmd.com/u/jarle)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/jarle/bun-check-if-the-current-file-is-the-entrypoint

---


# Check if the current file is the entrypoint

Bun provides a handful of module-specific utilities on the [`import.meta`](/runtime/module-resolution#import-meta) object. Use `import.meta.main` to check if the current file is the entrypoint of the current process.

```ts index.ts icon="https://mintcdn.com/bun-1dd33a4e/nIz6GtMH5K-dfXeV/icons/typescript.svg?fit=max&auto=format&n=nIz6GtMH5K-dfXeV&q=85&s=5d73d76daf7eb7b158469d8c30d349b0" theme={"theme":{"light":"github-light","dark":"dracula"}}
if (import.meta.main) {
  // this file is directly executed with `bun run`
} else {
  // this file is being imported by another file
}
```

***

See [Docs > API > import.meta](/runtime/module-resolution#import-meta) for complete documentation.

