Closed pi0 closed 8 months ago
Cloudflare node compat doesn't include node:crypto, but we could add a cloudflare-node-compat
preset to unenv to avoid polyfill what they already polyfill.
Originally posted by @Hebilicious in https://github.com/unjs/unenv/issues/111#issuecomment-1615152492
Let's hope they do support crypto too in the future. My main intention of this was AsyncLocalStorage support which is impossible in userland + possibly reduce bundle sizes when cloudflare supports some APIs.
More i am thinking, it makes more sense to take better control in framework level since it tightly depends on platform integration (and configuration!). Taking approach like https://github.com/unjs/unenv/pull/126 to allow platform injections via globalThis
.
Seems we need to reconsider this since platforms seem liking to stick with their flavored polyfill. Also added for deno https://github.com/unjs/unenv/pull/155
Related notes: https://github.com/unjs/nitro/issues/1171
https://developers.cloudflare.com/workers/runtime-apis/nodejs/