【问题标题】:How to Turn On Performance Optimization ON in react Native android?如何在 React Native android 中打开性能优化?
【发布时间】:2017-01-28 18:01:48
【问题描述】:

每当我运行我的应用程序时,我总是在我的开发者工具中看到

DEV === true,开发级警告开启,性能优化关闭

如何将性能优化设置为 ON 并将 DEV 设置为 False?

【问题讨论】:

    标签: react-native react-native-android


    【解决方案1】:

    当您创建生产 JavaScript 包时,DEV 模式会自动关闭。通常您不需要自己执行此操作,因为打包程序会在您运行 XCode 存档任务或 Android 部署时创建包。

    但是,您可以使用react-native bundle --dev=false 命令手动创建捆绑包,例如

    react-native bundle --dev=false --entry-file=index.ios.js --bundle-output=app.jsbundle --platform=ios
    

    bundle 命令采用以下选项:

    react-native bundle [options]
    builds the javascript bundle for offline use
    
    Options:
    
      -h, --help                   output usage information
      --entry-file <path>          Path to the root JS file, either absolute or relative to JS root
      --platform [string]          Either "ios" or "android"
      --transformer [string]       Specify a custom transformer to be used
      --dev [boolean]              If false, warnings are disabled and the bundle is minified
      --bundle-output <string>     File name where to store the resulting bundle, ex. /tmp/groups.bundle
      --bundle-encoding [string]   Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer).
      --sourcemap-output [string]  File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map
      --assets-dest [string]       Directory name where to store assets referenced in the bundle
      --verbose                    Enables logging
      --reset-cache                Removes cached files
      --read-global-cache          Try to fetch transformed JS code from the global cache, if configured.
      --config [string]            Path to the CLI configuration file
    

    【讨论】:

      猜你喜欢
      • 2020-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-02
      • 2019-04-20
      • 1970-01-01
      • 2017-05-21
      • 1970-01-01
      相关资源
      最近更新 更多