Files
bun.sh/docs/guides/util/entrypoint.md
Colin McDonnell 4c89c60867 Add files (#3826)
2023-07-26 14:59:39 -07:00

498 B

name
name
Check if the current file is the entrypoint

Bun provides a handful of module-specific utilities on the import.meta object. Use import.meta.main to check if the current file is the entrypoint of the current process.

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 for complete documentation.