@nrwl/react-native:bundle

JS Bundle target options.

Options can be configured in project.json when defining the executor, or when invoking it. Read more about how to configure targets and executors here: https://nx.dev/reference/project-configuration#targets.

project.json:

{ "name": "mobile", //... "targets": { //... "bundle-ios": { "executor": "@nrwl/react-native:bundle", "outputs": ["{projectRoot}/build"], "options": { "entryFile": "src/main.tsx", "platform": "ios", "bundleOutput": "dist/apps/mobile/ios/main.jsbundle" } }, "bundle-android": { "executor": "@nrwl/react-native:bundle", "options": { "entryFile": "src/main.tsx", "platform": "android", "bundleOutput": "dist/apps/mobile/android/main.jsbundle" } } } }
nx run mobile:bundle-ios nx run mobile:bundle-android

Examples

The sourcemapOutput option allows you to specify the path of the source map relative to app folder:

"bundle-ios": { "executor": "@nrwl/react-native:bundle", "options": { "entryFile": "src/main.tsx", "platform": "ios", "bundleOutput": "dist/apps/mobile/ios/main.jsbundle", "sourcemapOutput": "../../dist/apps/mobile/ios/main.map", } }, "bundle-android": { "executor": "@nrwl/react-native:bundle", "options": { "entryFile": "src/main.tsx", "platform": "android", "bundleOutput": "dist/apps/mobile/android/main.jsbundle", "sourcemapOutput": "../../dist/apps/mobile/android/main.map", } }

Options

assetsDest

string

Directory name where to store assets referenced in the bundle.

bundleOutput

Required
string

The output path of the generated files.

dev

boolean
Default: true

Generate a development build.

entryFile

Required
string

The entry file relative to project root.

minify

boolean

Allows overriding whether bundle is minified.

maxWorkers

number

The number of workers we should parallelize the transformer on.

platform

pRequired
string
Accepted values: ios, android

Platform to build for.

resetCache

boolean
Default: false

Removes cached files.

readGlobalCache

boolean
Default: false

Removes cached files.

sourcemapOutput

string

File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map.

sourcemapSourcesRoot

string

Path to make sourcemaps sources entries relative to, ex. /root/dir.

sourcemapUseAbsolutePath

boolean
Default: false

Report SourceMapURL using its full path.

transformer

string

Specify a custom transformer to be used.