Skip to content

Latest commit

 

History

History
79 lines (57 loc) · 2.03 KB

root-expo-object.md

File metadata and controls

79 lines (57 loc) · 2.03 KB

Migrating from the root-level expo object in the app config

Previous versions of Expo CLI encouraged users to have a top-level expo: {} object in the project's app config (app.json). This extraneous object contained all of the project config. When support for app.config.js and app.config.json were added, the root-level expo object became optional.

You can instead use the root-level object in the app config (app.json) to configure your project and Expo CNG:

app.json

{
-  "expo": {
    "name": "beta",
    "icon": "./icon.png",
    "plugins": [
        ["expo-router", { }]
    ]
-  }
}

We recommend Visual Studio Code users install the Expo Tools extension to get auto-completion of properties in app.json files.

Resolution with expo object

If the project's app config has a root-level expo object, then all other fields will be removed:

Input app.json

{
  "name": "alpha",
  "displayName": "alpha",
  "expo": {
    "name": "beta"
  }
}

When this config is read by Expo CLI, the root-level name and displayName will be removed:

Output app.json

{
  "name": "beta"
}

Migrating the config

Starting in Expo 51, a warning will be printed informing you to remove the root-level name and displayName properties or migrate the root-level expo object (preferred).

To migrate, simply remove the extraneous expo object:

Old app.json

{
-    "name": "alpha",
-    "displayName": "alpha",
-    "expo": {
        "name": "beta"
-    }
}

The new config should look as follows (displayName is not a supported property of Expo CLI):

New app.json

{
  "name": "beta"
}

Arbitrary fields

If you want to use arbitrary fields in the app config, use the extra object in the app config. Learn more about extra in the app config API reference.