browserify / browserify/randombytes
`global` Reference Error in Browser Environment
- 主要言語
- JavaScript
- スター
- 102
- フォーク
- 47
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
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
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Start with browser.js at the linked implementation and reproduce the failure by using randombytes@2.1.0 in a browser environment built with Vite. Trace the browser-side crypto initialization and verify that the build no longer raises "global is not defined" while still accessing the browser crypto implementation.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- web-dev
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100