perry-mitchell / ulidx

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

Browser imports broken #43

Closed aaronadamsCA closed 2 months ago

aaronadamsCA commented 2 months ago

https://unpkg.com/ulidx@2.4.0/package.json

As of v2.4.0, the "browser" and "worker" import conditions are unreachable, because they come after new catchall "import" and "require" conditions. As a result, browser and worker environments are importing the Node.js bundle and breaking on the "node:crypto" import.

▲ [WARNING] The package "node:crypto" wasn't found on the file system but is built into node.

  Your Worker may throw errors at runtime unless you enable the "nodejs_compat" compatibility flag. Refer to https://developers.cloudflare.com/workers/runtime-apis/nodejs/ for more details. Imported from:
   - ../../../node_modules/.pnpm/ulidx@2.4.0/node_modules/ulidx/dist/node/index.js

✘ [ERROR] Deployment failed!

  Failed to publish your Function. Got error: Uncaught Error: No such module "node:crypto".

I can file a PR now with something that should work without breaking what was fixed in #41.