【问题标题】:Transpiling es6 code in node_modules with React Native使用 React Native 在 node_modules 中转译 es6 代码
【发布时间】:2018-11-08 16:04:28
【问题描述】:

我正在尝试将使用 es6 功能(例如箭头语法)的模块与 react 本机项目集成。不幸的是,react native 似乎没有编译 node_modules 目录中的任何代码。我在.babelrc 文件中尝试了onlyignore 选项,但无济于事,它仍然从node_modules 文件夹中输出未转译的es6 代码,并在android 上运行时导致错误。是否有可能?如果可以,将特定模块白化以从 node_modules 文件夹中转译的最佳方法是什么?

【问题讨论】:

    标签: javascript react-native ecmascript-6 babeljs


    【解决方案1】:

    事实证明,react native 确实转换了 node_modules 文件夹中的代码。该问题实际上与 babel-react-native 预设中包含的自定义插件中的错误有关。错误报告在这里:https://github.com/facebook/react-native/issues/19511

    【讨论】:

      猜你喜欢
      • 2018-06-19
      • 1970-01-01
      • 2019-01-22
      • 2017-02-27
      • 2018-06-04
      • 2019-04-14
      • 2020-08-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多