【发布时间】:2018-06-13 11:24:10
【问题描述】:
我想在 React Native 的脚本中导入一个模块。这个模块只有 index.android.js 所以在 iOS 上导入失败。
我怎么能忽略它,因为我不需要 iOS 中的那个模块?
我尝试使用if (Platform.OS == 'android') Module = require('module'),但它仍然抛出 UnableToResolveError:
Module does not exist in the module map or in these directories: D:\myproject\node_modules
重要: 我不想修改模块。
【问题讨论】:
标签: javascript android node.js react-native import