【问题标题】:How to build react-native minified "prod" app for simulator?如何为模拟器构建 react-native 缩小的“产品”应用程序?
【发布时间】:2015-10-01 18:02:46
【问题描述】:

如何在模拟器上以 production 模式运行 react-native 应用程序?我想出了如何生成缩小包...

$ react-native bundle --minify
Building package...
transforming [========================================] 100% 302/302
Build complete
Successfully saved bundle to ios/main.jsbundle

...但我不明白如何将ios/main.jsbundle 加载到模拟器中。

【问题讨论】:

    标签: ios react-native


    【解决方案1】:

    我正在使用以下内容。 Xcode 不是从 iOS/main.jsbundle 而是从 iOS/PROJ/main.jsbundle 加载的。这可能只是我的情况,因为我已经升级了几次 react-native 版本。

    $ react-native bundle --out iOS/MyProj/main.jsbundle --minify
    

    关于产品,请使用?dev=false。还要确保构建为“发布”方案。

    // AppDelegate.m
    jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?dev=false"];
    

    【讨论】:

      猜你喜欢
      • 2021-10-05
      • 2017-09-30
      • 1970-01-01
      • 1970-01-01
      • 2016-06-17
      • 1970-01-01
      • 1970-01-01
      • 2020-07-23
      • 1970-01-01
      相关资源
      最近更新 更多