栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

找不到变量:缓冲区

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

找不到变量:缓冲区

回到这个问题上,以防万一有人卡住。解决方法是从根本上尝试在不同时间填充不同的包装以更改加载顺序。

当TYPED_ARRAY_SUPPORT被不同地对待并且Buffer更依赖于它时,我们尝试回到另一个版本。在旧版本中,我们尝试了许多不同的方法,最终放弃了,并通过将缓冲区更新到最新版本来回溯,最终一切正常。

我的意思是说,我们不确定如何解决它,但这是通过随机更改装载顺序直到幸运为止。我知道这不是一个很好的答案,但是我可以为这个问题提供最好的答案。

这就是我们的global.js最后的样子

// Inject node globals into React Native global scope.// Required for crypto functionality for bitcoinjs-lib, web3, etc.global.Buffer = require('buffer').Buffer;//global.Buffer.TYPED_ARRAY_SUPPORT = false;global.process = require('process');global.process.env.NODE_ENV = __DEV__ ? 'development' : 'production';var getRandomValues = function(byteArray) {  var bytes = crypto.rng.randomBytes(byteArray.length);  for (let i = 0; i < byteArray.length; i++) {    byteArray[i] = bytes[i];  }};// "But Zach, aren't you just doing the same thing twice?"// Yes. Initializing the crypto-browserify module eventually requires// crypto.getRandomValues to exist, so we must add it here once.// However, crypto-browserify does not support getRandomValues, so we// must re-add it after loading the module.global.crypto = { getRandomValues };global.crypto.rng = require('react-native-randombytes');global.crypto = require('crypto');global.crypto.getRandomValues = getRandomValues;global.crypto.rng = require('react-native-randombytes');crypto.rng.seedSJCL();// Needed so that 'stream-http' chooses the right default protocol.global.location = {  protocol: 'file:'};


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/485062.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号