We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug The random module does not work with react-native expo.
I have followed the instructions in the README.md (installed isomorphic-webcrypto and enabled unstable_enablePackageExports).
The isomorphic-webcrypto module isn't resolved correctly.
Error message: TypeError: Cannot read property 'ensureSecure' of undefined, js engine: hermes
TypeError: Cannot read property 'ensureSecure' of undefined, js engine: hermes
Stacktrace:
To Reproduce
npx create-expo-app@latest
import * as random from 'lib0/random'
random.rand()
npx expo start
Expected behavior Lib0 random module works with react-native expo.
Environment Information
Additional context A workaround I have found is to hack the metro resolver:
// Learn more https://docs.expo.io/guides/customizing-metro const { getDefaultConfig } = require("expo/metro-config"); /** @type {import('expo/metro-config').MetroConfig} */ const defaultConfig = getDefaultConfig(__dirname); console.warn("THERE") const config = defaultConfig; config.resolver.unstable_enablePackageExports = true; config.resolver.resolveRequest = (context, moduleName, platform) => { if (platform !== "web" && moduleName === "isomorphic-webcrypto") { return { filePath: __dirname + "/node_modules/isomorphic-webcrypto/src/react-native.js", type: "sourceFile", }; } return context.resolveRequest(context, moduleName, platform); }; module.exports = config;
The text was updated successfully, but these errors were encountered:
I also opened a PR with a fix for this issue: #94
Sorry, something went wrong.
dmonad
Successfully merging a pull request may close this issue.
Describe the bug
The random module does not work with react-native expo.
I have followed the instructions in the README.md (installed isomorphic-webcrypto and enabled unstable_enablePackageExports).
The isomorphic-webcrypto module isn't resolved correctly.
Error message:
TypeError: Cannot read property 'ensureSecure' of undefined, js engine: hermes
Stacktrace:
To Reproduce
npx create-expo-app@latest
import * as random from 'lib0/random'
and userandom.rand()
npx expo start
Expected behavior
Lib0 random module works with react-native expo.
Environment Information
Additional context
A workaround I have found is to hack the metro resolver:
The text was updated successfully, but these errors were encountered: