browser-or-node icon indicating copy to clipboard operation
browser-or-node copied to clipboard

`node:process` free solution

Open jimmywarting opened this issue 1 year ago • 1 comments

Some bundlers automatically polyfills global Buffer and process if they can detect it being used. it really bugs me soooo much.

trying to import this via a cdn like: https://esm.sh/browser-or-node is going to import both node:process and node:events. just for using process in the code.

i think if you use isNode = globalThis.process?.versions?.node then, you will be fine.

jimmywarting avatar Sep 26 '23 18:09 jimmywarting

also, was wondering if you could include BunJS detection into this as well...

this would then really have to change name from something like runtime-environment instead of browser-or-node guess it's too late for that now...

jimmywarting avatar Sep 26 '23 18:09 jimmywarting