browserify / browserify/crypto-browserify
randomBytes is required from randombytes which requires from crypto
- Dominant language
- JavaScript
- Stars
- 681
- Forks
- 209
- PR merge metrics
- No merged PRs in 30d
Description
I have been having issues with browserified code using this package because it depends on non-browserified code to implement itself.
Basically, this line is the issue:
```js
exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes');
```
When you require `crypto-browserify`, you're not using the non-browserified `crypto` package. But if you go to `randombytes`' implementation, it requires `crypto` in its code. This causes two issues:
1. If you are resolving requires to `crypto`as `crypto-browserify`, you get a circular dependency and the `randomBytes` field becomes `undefined`.
2. If you are not, `randombytes` will just require regular `crypto`, which defeats the whole purpose of using a browserified package in the first place. You probably won't have it available in your environment and just end up with nothing in the `randomBytes` field anyway.
Maybe this is an issue for [randombytes](https://github.com/browserify/randombytes) instead. But I figured that most packages that depend on `randomBytes` usually require `crypto` instead of `randombytes`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.