Skip to content

The @nx/expo plugin provides various executors to help you create and configure expo projects within your Nx workspace. Below is a complete reference for all available executors and their options.

build

Start an EAS build for your expo project.

Options

OptionTypeDescriptionDefault
autoSubmitbooleanSubmit on build complete using the submit profile with the same name as the build profilefalse
autoSubmitWithProfilestringSubmit on build complete using the submit profile with provided name
buildLoggerLevelstringThe level of logs to output during the build process."info"
clearCachebooleanClear cache before the buildfalse
freezeCredentialsbooleanPrevent the build from updating credentials in non-interactive modefalse
interactivebooleanRun command in interactive modetrue
jsonbooleanEnable JSON output, non-JSON messages will be printed to stderrfalse
localbooleanRun build locally [experimental]false
messagestringA short message describing the build
outputstringOutput path for local build
platformanyThe platform to build the app, exaple values: ios, android, all.
profilestringName of the build profile from eas.json. Defaults to “production” if defined in eas.json.
waitbooleanWait for build(s) to completetrue

build-list

List all Expo Application Services (EAS) builds for your Expo project.

The build-list command allows to check the details of your Expo Application Services (EAS) build status.

project.json:

{
"name": "mobile",
//...
"targets": {
//...
"build-list": {
"executor": "@nx/expo:build-list",
"options": {}
}
//...
}
}
Terminal window
nx run mobile:build-list

Examples

{% tabs %} {% tab label=“Get Status of Different Platforms” %} The platform option allows you to check build status of different platform (e.g. android, ios, all):

"build-list": {
"executor": "@nx/expo:build-list",
"options": {
"platform": "ios"
}
}

{% /tab %} {% tab label=“Get Status Interactively” %}

The interactive option allows you to specify whether to use interactive mode:

"build-list": {
"executor": "@nx/expo:build-list",
"options": {
"interactive": true
}
}

{% /tab %} {% tab label=“Get Status in JSON Format” %}

The json option allows you to print the output in JSON format:

"build-list": {
"executor": "@nx/expo:build-list",
"options": {
"interactive": false,
"json": true
}
}

{% /tab %} {% /tabs %}


Options

OptionTypeDescriptionDefault
appBuildVersionstringApp build version of EAS build
appIdentifierstringApp identifier of EAS build
appVersionstringApp version of EAS build
buildProfilestringBuild profile of EAS build
channelstringChannel of EAS build
distributionanyDistribution of EAS build
gitCommitHashstringGit commit hash of EAS build
interactivebooleanRun the command in interactive mode.
jsonbooleanEnable JSON output, non-JSON messages will be printed to stderr
limitnumberLimit of numbers to list EAS builds
platformanyThe platform to build the app.
runtimeVersionstringRuntime version of EAS build
sdkVersionstringSDK version of EAS build
statusanyStatus of EAS build

Ensure workspace node_modules is symlink under app’s node_modules folder.

export

Export the JavaScript and assets for your app using Metro/webpack bundler.

project.json:

{
"name": "mobile",
//...
"targets": {
//...
"export": {
"executor": "@nx/expo:export",
"options": {
"outputs": ["{options.outputDir}"],
"platform": "all",
"outputDir": "dist/apps/mobile"
},
"dependsOn": ["sync-deps"]
}
//...
}
}
Terminal window
nx run mobile:export

Examples

{% tabs %} {% tab label=“Specify outputDir” %} The outputDir option allows you to specify the output directory of your bundle:

"export": {
"executor": "@nx/expo:export",
"outputs": ["{options.outputDir}"],
"options": {
"platform": "all",
"bundler": "metro",
"outputDir": "dist/apps/mobile"
},
"dependsOn": ["sync-deps"]
},

or run command: nx run mobile:export --outputDir=dist/apps/mobile.

{% /tab %} {% tab label=“Specify the platform” %} The platform option allows you to specify the platform to compile with metro bundler: “ios”, “android”, “all”, and “web”.

For example, to bundle for web:

"export": {
"executor": "@nx/expo:export",
"outputs": ["{options.outputDir}"],
"options": {
"platform": "web",
"bundler": "metro",
"outputDir": "dist/apps/dogs"
},
"dependsOn": ["sync-deps"]
},

or run command nx export mobile --platform=web.

{% /tab %} {% tab label=“Bundle for development” %}

The dev option allows you to bundle for development environments.

"export": {
"executor": "@nx/expo:export",
"outputs": ["{options.outputDir}"],
"options": {
"platform": "web",
"bundler": "metro",
"outputDir": "dist/apps/dogs",
"dev": true
},
"dependsOn": ["sync-deps"]
},

or run command nx export mobile --dev.

{% /tab %} {% tab label=“Clear bundle cache” %}

The clear option allows you to clear bundle cache.

"export": {
"executor": "@nx/expo:export",
"outputs": ["{options.outputDir}"],
"options": {
"platform": "web",
"bundler": "metro",
"outputDir": "dist/apps/dogs",
"clear": true
},
"dependsOn": ["sync-deps"]
},

or run command nx export mobile --clear.

{% /tab %} {% /tabs %}

Options

OptionTypeDescriptionDefault
platformany [required]Choose the platform to compile for"all"
clearbooleanClear the bundler cache before exporting
devbooleanConfigure static files for developing locally using a non-https server
dumpAssetmapbooleanWhen bundler is metro, whether to dump the asset map for further processing
maxWorkersnumberWhen bundler is metro, the maximum number of tasks to allow the bundler to spawn
minifybooleanMinify source
outputDirstringRelative to workspace root, the directory to export the static files to. Default: dist
sourceMapsbooleanWhen bundler is metro, whether to emit JavaScript source maps

install

Install a module or other package to a project.

Options

OptionTypeDescriptionDefault
checkbooleanCheck which installed packages need to be updatedfalse
fixbooleanAutomatically update any invalid package versionsfalse
forcebooleanForce the installation of a package, even if it is already installedfalse
packagesarrayThe names of packages to install[]

prebuild

Create native iOS and Android project files for building natively.

The prebuild command generates native code before a native app can compile.

project.json:

{
"name": "mobile",
//...
"targets": {
//...
"prebuild": {
"executor": "@nx/expo:prebuild",
"options": {}
}
//...
}
}
Terminal window
nx run mobile:prebuild

Examples

{% tabs %} {% tab label=“Generate Native Code for Different Platforms” %} The platform option allows you to specify the platform to generate native code for (e.g. android, ios, all).

"prebuild": {
"executor": "@nx/expo:prebuild",
"options": {
"platform": "android"
}
}

{% /tab %} {% tab label=“Regenerate Native Code” %}

The clean option allows you to delete the native folders and regenerate them before apply changes.

"prebuild": {
"executor": "@nx/expo:prebuild",
"options": {
"clean": true
}
}

{% /tab %} {% tab label=“Install NPM Packages and CocoaPods” %}

The install option allows you to install NPM Packages and CocoaPods.

"prebuild": {
"executor": "@nx/expo:prebuild",
"options": {
"install": true
}
}

{% /tab %} {% /tabs %}


Options

OptionTypeDescriptionDefault
platformany [required]Platforms to sync"all"
cleanbooleanDelete the native folders and regenerate them before applying changesfalse
installbooleanInstalling npm packages and CocoaPods.true
templatestringProject template to clone from. File path pointing to a local tar file or a github repo

run

Run Expo target options.

The run command allows you to compile your app locally.

project.json:

{
"name": "mobile",
//...
"targets": {
//...
"run-ios": {
"executor": "@nx/expo:run",
"options": {
"platform": "ios"
}
},
"run-android": {
"executor": "@nx/expo:run",
"options": {
"platform": "android"
}
}
//...
}
}
Terminal window
nx run mobile:run-ios
nx run mobile:run-android

Examples

{% tabs %} {% tab label=“Compile Android with Different Variants” %} The variant option allows you to specify the compile Android app with variants defined in build.gradle file (e.g. debug, release).

"run-android": {
"executor": "@nx/expo:run",
"options": {
"platform": "android",
"variant": "release"
}
}

{% /tab %} {% tab label=“Compile iOS with Different Configurations” %}

The xcodeConfiguration option allows you to specify Xcode configuration to use (e.g. Debug or Release).

"run-ios": {
"executor": "@nx/expo:run",
"options": {
"platform": "ios",
"xcodeConfiguration": "Release"
}
}

{% /tab %} {% tab label=“Run on a device” %}

The device option allows you to launch your app in a specific device name or UDID. To see all your iOS simulators: run xcrun simctl list devices available. To see all your Android emulators, run: emulator -list-avds.

"run-ios": {
"executor": "@nx/expo:run",
"options": {
"platform": "ios",
"device": "iPhone 14"
}
},
"run-android": {
"executor": "@nx/expo:run",
"options": {
"platform": "android",
"device": "Pixel_XL_API_Tiramisu"
}
}

{% /tab %} {% /tabs %}


Options

OptionTypeDescriptionDefault
platformany [required]Platform to run for (ios, android)."ios"
buildCachebooleanShould use derived data for builds.
bundlerbooleanWhether to skip starting the Metro bundler. True to start it, false to skip it.
cleanbooleanDelete the native folders and regenerate them before applying changesfalse
devicestringDevice name or UDID to build the app on. The value is not required if you have a single device connected.
installbooleanInstalling npm packages and CocoaPods before building.true
portnumberPort to start the Metro bundler on8081
schemestring(iOS) Explicitly set the Xcode scheme to use
variantstring(Android) Specify your app’s build variant (e.g. debug, release)."debug"
xcodeConfigurationstring(iOS) Xcode configuration to use. Debug or Release"Debug"

serve

Packager Server target options.

Options

OptionTypeDescriptionDefault
clearbooleanClear the Metro bundler cache
devbooleanTurn development mode on or off
maxWorkersnumberMaximum number of tasks to allow Metro to spawn
minifybooleanWhether or not to minify code
portnumberPort to start the native Metro bundler on (does not apply to web or tunnel)4200

start

Packager Server target options.

project.json:

{
"name": "mobile",
//...
"targets": {
//...
"start": {
"executor": "@nx/expo:start",
"options": {
"port": 8081
}
}
//...
}
}
Terminal window
nx run mobile:start

Examples

{% tabs %} {% tab label=“Specify starting on platform” %} The ios, android and web option allows you to start the server on different platforms.

Opens your app in Expo Go in a currently running iOS simulator on your computer:

"start": {
"executor": "@nx/expo:start",
"options": {
"port": 8081,
"ios": true
}
}

or run command nx start <your app name> --ios.

Opens your app in Expo Go on a connected Android device

"start": {
"executor": "@nx/expo:start",
"options": {
"port": 8081,
"android": true
}
}

or run command nx start <your app name> --android.

Opens your app in a web browser:

"start": {
"executor": "@nx/expo:start",
"options": {
"port": 8081,
"web": true
}
}

or run command nx start <your app name> --web.

{% /tab %} {% tab label=“Specify the host” %} The host option allows you to specify the type of host to use. lan uses the local network; tunnel ues any network by tunnel through ngrok; localhost connects to the dev server over localhost.

"start": {
"executor": "@nx/expo:start",
"options": {
"port": 8081,
"host": "localhost"
}
}

{% /tab %} {% tab label=“Starts the server with cache reset” %}

The clear option allows you to remove Metro bundler cache.

"start": {
"executor": "@nx/expo:start",
"options": {
"port": 8081,
"clear": true
}
}

{% /tab %} {% /tabs %}


Options

OptionTypeDescriptionDefault
androidbooleanOpens your app in Expo Go on a connected Android device
clearbooleanClear the Metro bundler cache
devbooleanTurn development mode on or off
devClientbooleanExperimental: Starts the bundler for use with the expo-development-client
forceManifestTypestringOverride auto detection of manifest type.
hoststringlan (default), tunnel, localhost. Type of host to use. lan uses the local network; tunnel ues any network by tunnel through ngrok; localhost connects to the dev server over localhost.
httpsbooleanTo start webpack with https or http protocol
iosbooleanOpens your app in Expo Go in a currently running iOS simulator on your computer
lanbooleanSame as —host lan
localhostbooleanSame as —host localhost
maxWorkersnumberMaximum number of tasks to allow Metro to spawn
minifybooleanWhether or not to minify code
offlinebooleanAllows this command to run while offline
portnumberPort to start the native Metro bundler on (does not apply to web or tunnel)19000
privateKeyPathstringPath to private key for code signing. Default: ‘private-key.pem’ in the same directory as the certificate specified by the expo-updates configuration in app.json.
schemestringCustom URI protocol to use with a development build
tunnelbooleanSame as —host tunnel
webbooleanOpens your app in a web browser

submit

Submit app binary to App Store and/or Play Store.

Options

OptionTypeDescriptionDefault
idstringBuild ID to submit
interactivebooleanRun command in interactive modetrue
latestbooleanSubmit the latest build for specified platform
pathstringPath to the .apk/.aab/.ipa file
platformanyThe platform to build the app, example values: ios, android, all.
profilestringName of the build profile from eas.json. Defaults to “production” if defined in eas.json.
urlstringURL to the .apk/.aab/.ipa file, app archive url
waitbooleanWait for build(s) to completetrue

sync-deps

Updates package.json with project dependencies.

Options

OptionTypeDescriptionDefault
allbooleanCopy all dependencies and devDependencies from the workspace root package.json.false
excludearrayAn array of npm packages to exclude.[]
excludeImplicitbooleanThis will ignore npm packages from projects listed in implicitDependencies (e.g. backend API projects)false
includearrayAn array of additional npm packages to include.[]

update

Start an EAS update for your expo project.

Options

OptionTypeDescriptionDefault
autobooleanUse the current git branch and commit message for the EAS branch and update messagefalse
branchstringBranch to publish the update group on
groupstringUpdate group to republish
inputDirstringLocation of the bundle
interactivebooleanRun command in interactive modetrue
jsonbooleanEnable JSON output, non-JSON messages will be printed to stderrfalse
messagestringA short message describing the update
platformanyThe platform to build the app, example values: ios, android, all."all"
privateKeyPathstringFile containing the PEM-encoded private key corresponding to the certificate in expo-updates’ configuration. Defaults to a file named “private-key.pem” in the certificate’s directory.
republishbooleanRepublish a previous update within a branchfalse
skipBundlerbooleanSkip running Expo CLI to bundle the app before publishingfalse