首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >世博反应本机找不到变量: TextDecoder

世博反应本机找不到变量: TextDecoder
EN

Stack Overflow用户
提问于 2022-07-08 14:21:56
回答 2查看 632关注 0票数 2

因此,出于某种原因,当我试图在我的手机上运行博览Go应用程序时,我就有了这个bug。如果我在网络浏览器上运行的话,显然是可以的。

这是错误日志

ReferenceError:找不到变量: TextDecoder

堆栈跟踪:

node_modules\expo\build\environment\react-native-logs.fx.js:27:4误差

node_modules\react-native\Libraries\Core\ExceptionsManager.js:95:4 in reportException

node_modules\react-native\Libraries\Core\ExceptionsManager.js:141:19 in handleException

node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:6 in handleError

node_modules@react-native\polyfills\error-guard.js:49:36 in ErrorUtils.reportFatalError

node_modules\metro-runtime\src\polyfills\require.js:203:6 in guardedLoadModule

全球代码中的http://192.168.0.29:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:190345:3 .

EN

回答 2

Stack Overflow用户

发布于 2022-08-23 00:49:36

这也发生在我们身上,在一款应用程序上,它曾经在一个较老的世博会版本中工作过。我们的解决方案是将这一行添加到.babelrc.js文件中:

代码语言:javascript
复制
"presets": [
  ["babel-preset-expo", {
    lazyImports: true, // <<< The fix
  ]
]
票数 1
EN

Stack Overflow用户

发布于 2022-07-21 09:57:54

通过这样做,克服了这个问题;

npm install text-encoding

npm install big-integer

并将此代码粘贴在节点_模块>react本机>库>LogBox中。

代码语言:javascript
复制
const TextEncodingPolyfill = require('text-encoding');
const BigInt = require('big-integer')
Object.assign(global, {
  TextEncoder: TextEncodingPolyfill.TextEncoder,
  TextDecoder: TextEncodingPolyfill.TextDecoder,
  BigInt: BigInt,
});
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72912840

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档