That's not a big problem, e.g. if you are using a Bun API for speed or some other specific reason, you can always do:
if (typeof Bun === "undefined") {
// Node.js code
} else {
// Bun code
}
If you are writing a lot of Bun-specific code, yeah that will only work on Bun ofc. But I like that now I can add some small snippets of bun-optimized code in my libraries.
Otherwise, normally you'd use ESM APIs > Node.js APIs > Bun APIs, like if you are hashing something, right?
Otherwise, normally you'd use ESM APIs > Node.js APIs > Bun APIs, like if you are hashing something, right?