perry-mitchell / ulidx

ULID generator for NodeJS and the browser
MIT License
281 stars 17 forks source link

Update package.json exports #44

Closed aaronadamsCA closed 2 months ago

aaronadamsCA commented 2 months ago

This should resolve #43.

I also exported your package.json as this is very common in large packages. I don't know why, mind you; something to do with bundlers?

aaronadamsCA commented 2 months ago

Oh, this is closest to https://unpkg.com/axios@1.7.3/package.json in case you want to compare. The only difference is the fallback order.

perry-mitchell commented 2 months ago

Hi @aaronadamsCA - Thanks for this!

Is there any reason we can't have node as the default? I'd prefer it over having the browser entry there..

Dallas62 commented 2 months ago

Hello @perry-mitchell, unfortunately all runtime cannot run with the node:crypto, in my case, React Native doesn't support it as is. At least this change should not be in a minor change.

aaronadamsCA commented 2 months ago

@perry-mitchell, yeah, it's for the reason @Dallas62 indicates. Since "node" is currently first, it should remain that way to prevent any new problems.

IMO that part's already correct, too, because "node" is the exception with "node:crypto", while every other runtime uses the Web Crypto API.

Plus this is all just transitional. In 8 months Node.js 18 goes EOL, at which point I'm pretty sure you no longer need a "node" build at all! Because globalThis.crypto is stable in Node.js 20. So what you've historically called your "browser" build really is your default build now, and only Node.js 16-18 need the "node" build for legacy support.

Dallas62 commented 2 months ago

Any update @perry-mitchell ?

perry-mitchell commented 2 months ago

Released under 2.4.1