Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Expo, #468 #515

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix Expo, #468 #515

wants to merge 1 commit into from

Conversation

steida
Copy link

@steida steida commented Jan 5, 2025

No description provided.

@ai
Copy link
Owner

ai commented Jan 5, 2025

  1. Can you give me some proofs that React Native support global.crypto right now
  2. Do we need to change docs? https://github.com/ai/nanoid?tab=readme-ov-file#react-native

@steida
Copy link
Author

steida commented Jan 6, 2025

I use only this:

import { install } from "react-native-quick-crypto";
install();

The same fix works for both NanoId versions (3/5).

Here is my package.json:

"type": "module",
  "types": "./dist/src/index.d.ts",
  "exports": {
    ".": {
      "types": "./dist/src/index.d.ts",
      "import": "./dist/src/index.js",
      "browser": "./dist/src/index.js",
      "react-native": "./dist/src/index.js"
    },
    "./evolu": {
      "import": "./dist/src/Evolu/Internal.js"
    }
  },
  "typesVersions": {
    "*": {
      "evolu": [
        "./dist/src/Evolu/Internal.d.ts"
      ]
    }
  },

Btw, I think it should be mentioned that it's recommended to use nanoid 3 in monorepos with hoisting enabled because many packages are still using nanoid 3 (which is not dead; that should also be mentioned). Anyway, thank you for your work.

@ai
Copy link
Owner

ai commented Jan 6, 2025

Honestly, this PR looks like quick fix which will break workflow of many users because the changes was not careful considered and planned.

Can you explain me what happened and how did we find exactly this solution (and not another one). How migration from current Nano ID 5.x will looks like?

import { install } from "react-native-quick-crypto";
install()

Is the code will fail without it?

Why we are not mentioning it in the docs?

Why it is better than previous polyfill?

Btw, I think it should be mentioned that it's recommended to use nanoid 3 in monorepos with hoisting enabled because many packages are still using nanoid 3

We can release the be version of 3.x with the new polyfill

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants