Unable to resolve module `crypto` from `node_modules/typeorm/browser/util/StringUtils.js`
See original GitHub issueIssue type:
[ ] question [x] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[x] react-native
[ ] expo
TypeORM version:
[ ] latest
[ ] @next
[x] 0.2.22
(this is the latest
at this moment)
When using with React Native I’m getting “Unable to resolve module crypto
” error when trying to use TypeORM.
The issue appears in the 0.2.22 only. This is due to the following recent change:
https://github.com/typeorm/typeorm/commit/edc8e6dfd2c250656ab5b143297c60f57787ce77#diff-3fbb9e2b917220327e7c2fe6522c9b6d
Steps to reproduce or a small repository showing the problem:
react-native init TypeormHash
cd TypeormHash
Add "import {Entity} from 'typeorm/browser';" at the top of App.js
react-native run-android
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:17 (11 by maintainers)
Top GitHub Comments
I guess this is open for discussions as I’m not sure this is the right approach. My own fix is to use sha.js instead of “crypto” which is not available in RN: https://github.com/nochkin/typeorm/commit/ba160304f89e8a533b075d4af9961066a09bd05a I can make a PR if this is acceptable.
Can we have a release please? The latest version is broken on React Native.