在React Native中启用内联要求导致最大调用堆栈大小超出错误

问题描述 投票:0回答:1

inlineRequires中启用metro.config.js时,由于超出了最大调用堆栈大小,可能导致React-Native应用程序无法启动。但是,它的确取决于操作系统以及是否连接了调试器以及连接了哪种类型的调试器。

  • 没有调试器的iOS-崩溃
  • 带有Chrome调试器的iOS设备-崩溃
  • 带有React Native Debugger的iOS-很好
  • 没有调试器的Android-很好
  • 带有Chrome调试器的Android设备-崩溃
  • 带有React Native Debugger的Android-很好

我不确定为什么存在这些不一致之处,具体取决于是否连接了调试器,在尝试启用inlineRequires时是否有人遇到类似问题?

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLmltZ3VyLmNvbS9PbkRyeGtNLnBuZyJ9” alt =“堆栈溢出”>

  React Native Environment Info:
    System:
      OS: macOS 10.14.5
      CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
      Memory: 153.84 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 12.6.0 - /usr/local/bin/node
      Yarn: 1.17.3 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 22, 23, 24, 25, 26, 27, 28
        Build Tools: 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1, 24.0.2, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.1, 27.0.2, 27.0.3, 28.0.2, 28.0.3
        System Images: android-22 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-Q | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5199772
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3
      react-native: 0.59.10 => 0.59.10
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      eslint-plugin-react-native: 3.2.1
      react-native-cli: 2.0.1

metro.config.js

/**
 * Metro configuration for React Native
 * https://github.com/facebook/react-native
 *
 * @format
 */

module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: true,
        inlineRequires: true,
      },
    }),
  },
};

javascript react-native babeljs stack-overflow metro-bundler
1个回答
0
投票

这里有同样的问题,您设法解决吗?或了解根本原因?

© www.soinside.com 2019 - 2024. All rights reserved.