Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Turn On Performance Optimization ON in react Native android?

Tags:

react-native

Whenever I run my app I always see in my Developer Tools that

DEV === true, development-level warning are ON, performance optimizations are OFF

How can I set Performance Optimisation to ON and DEV to False?

like image 494
Supermacy Avatar asked Mar 11 '23 00:03

Supermacy


1 Answers

The DEV mode is automatically turned off, when you create the production javascript bundle. Typically you don't need to do this yourself, as the packager creates the bundle when you run the XCode Archive task or Android deploy.

However, you can create the bundle manually with the react-native bundle --dev=false command, e.g.

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

The bundle command takes the following options:

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
like image 157
jevakallio Avatar answered Apr 30 '23 03:04

jevakallio