browserify / browserify/randombytes
`global` Reference Error in Browser Environment
- Lingua principale
- JavaScript
- Stelle
- 102
- Fork
- 47
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
When using `randombytes@2.1.0` in a browser environment with Vite as the build tool, the following error occurs:
```bash
Uncaught ReferenceError: global is not defined
```
This error stems from the browser.js implementation attempting to access the `global` object which is not available in browser DOM environments:
```javascript
var Buffer = require('safe-buffer').Buffer
var crypto = global.crypto || global.msCrypto
```
As the source code mentioned below `crypto` is defined correctly
https://github.com/browserify/randombytes/blob/b4eb4126fccc503e375853ca7b3e96aaa34af9e6/browser.js#L15-L16
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.