-
Currently doing this which works: #!/usr/bin/env bun
if (Bun.main === __filename) {
console.log('is main');
} else {
console.log('is not main ');
} Is there a better way? |
Beta Was this translation helpful? Give feedback.
Answered by
alexeyten
Feb 14, 2024
Replies: 1 comment 1 reply
-
Is https://bun.sh/docs/api/import-meta if (import.meta.main) {
console.log('is main');
} else {
console.log('is not main ');
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
rhyek
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is
import.meta.main
what you want?https://bun.sh/docs/api/import-meta