res.json<T>()yarn wrangler dev --node-compat however I still get the error there are no matching exports even though they should be supported according to the docs (https://developers.cloudflare.com/workers/runtime-apis/nodejs/crypto/)crypto.randomUUID()import crypto from 'node:crypto'; does not workcrypto.randomUUID() and crypto.getRandomValues() in the Worker runtime, I ended up using that even though it may not be 100% node compatiblenodejs_compat flag?--node-compat, which is the old polyfill method
nodejs_compat because it imports crypto instead of node:crypto. Is there some way I can make this third party library use the polyfill modules?crypto to node:crypto, then mark it as external--node-compat worked out of the box. Is this really the way to go when using any third party library that uses node modules?cloudflare:
esbuild, then run the build yourselfwrangler provided onewrangler deploy count in 1MB limit?workers.api.error.script_too_largefetch handler) without awaiting ityarn wrangler dev --node-compat✘ [ERROR] No matching export in "node-modules-polyfills:crypto" for import "randomBytes"
src/index.ts:38:9:
38 │ import { randomBytes } from 'node:crypto';
╵ ~~~~~~~~~~~crypto.randomUUID()crypto.randomUUID()import crypto from 'node:crypto';crypto.getRandomValues()cryptocryptonode:cryptonode:cryptocloudflare:wranglerworkers.api.error.script_too_large