Expo Constants provides comprehensive access to app manifests and configuration data across different deployment scenarios. The system intelligently handles multiple manifest formats and sources with automatic fallback behavior.
Access to the standard Expo configuration from app.json and app.config.js files.
/**
* Standard Expo config object from app.json/app.config.js
* Works across classic and modern manifests, embedded or remote
*/
expoConfig: (ExpoConfig & {
/** Only present during development using @expo/cli */
hostUri?: string;
}) | null;Usage Examples:
import Constants from "expo-constants";
// Access app configuration
const config = Constants.expoConfig;
if (config) {
console.log("App name:", config.name);
console.log("App version:", config.version);
console.log("App slug:", config.slug);
// Development-specific
if (config.hostUri) {
console.log("Development server:", config.hostUri);
}
// Platform-specific config
if (config.ios) {
console.log("iOS bundle ID:", config.ios.bundleIdentifier);
}
if (config.android) {
console.log("Android package:", config.android.package);
}
}Access to legacy embedded manifests (deprecated in favor of expoConfig).
/**
* Legacy embedded manifest (deprecated, use expoConfig instead)
* Returns null when manifest2 is available
*/
manifest: EmbeddedManifest | null;Usage Examples:
import Constants from "expo-constants";
// Legacy manifest access (deprecated)
const manifest = Constants.manifest;
if (manifest) {
console.log("Legacy app name:", manifest.name);
console.log("Legacy version:", manifest.version);
}Access to modern Expo Updates manifests from EAS Update or similar services.
/**
* Modern Expo Updates manifest for apps using EAS Update
* Contains metadata and asset information for remote updates
*/
manifest2: ExpoUpdatesManifest | null;Usage Examples:
import Constants from "expo-constants";
// Modern manifest access
const manifest2 = Constants.manifest2;
if (manifest2) {
console.log("Update ID:", manifest2.id);
console.log("Runtime version:", manifest2.runtimeVersion);
console.log("Created at:", manifest2.createdAt);
// Access embedded Expo config
if (manifest2.extra?.expoClient) {
console.log("App name:", manifest2.extra.expoClient.name);
}
}Configuration specific to Expo Go client applications.
/**
* Expo Go specific configuration
* Populated when running in Expo Go
*/
expoGoConfig: ExpoGoConfig | null;Usage Examples:
import Constants from "expo-constants";
// Expo Go specific config
const expoGoConfig = Constants.expoGoConfig;
if (expoGoConfig) {
console.log("Running in Expo Go");
// Access Expo Go specific settings
}Configuration specific to Expo Application Services (EAS) builds and updates.
/**
* EAS specific configuration
* Populated when using EAS Build or EAS Update
*/
easConfig: EASConfig | null;Usage Examples:
import Constants from "expo-constants";
// EAS specific config
const easConfig = Constants.easConfig;
if (easConfig) {
console.log("Using EAS services");
// Access EAS specific settings
}Expo Constants follows a specific priority order when resolving manifests:
expo-updates provides a non-empty manifest, it takes precedenceEXDevLauncher provides a manifest, it's used nextExponentConstants// Priority resolution example
import Constants from "expo-constants";
// Check which manifest source is being used
if (Constants.manifest2) {
console.log("Using Expo Updates manifest");
} else if (Constants.manifest) {
console.log("Using embedded manifest");
} else {
console.log("No manifest available");
}Different execution environments handle missing manifests differently:
import Constants, { ExecutionEnvironment } from "expo-constants";
try {
// Accessing manifest in different environments
const manifest = Constants.manifest;
if (Constants.executionEnvironment === ExecutionEnvironment.Bare) {
// In bare workflow, manifest can be null without error
// Warning may be logged to console
if (!manifest) {
console.log("Manifest not available in bare workflow");
}
} else if (
Constants.executionEnvironment === ExecutionEnvironment.Standalone ||
Constants.executionEnvironment === ExecutionEnvironment.StoreClient
) {
// In standalone/store environments, manifest should always exist
// Will throw CodedError if null
console.log("Manifest guaranteed to exist:", manifest);
}
} catch (error) {
if (error.code === 'ERR_CONSTANTS_MANIFEST_UNAVAILABLE') {
console.error("Manifest is unexpectedly unavailable:", error.message);
}
}On web, manifests are typically embedded at build time:
// Web-specific manifest handling
if (Constants.executionEnvironment === ExecutionEnvironment.Bare) {
// Web manifest comes from process.env.APP_MANIFEST
const webManifest = Constants.manifest;
console.log("Web manifest:", webManifest);
}For server-side rendering, use the server-compatible import:
// Server-side import (automatically resolved via package.json exports)
import Constants from "expo-constants";
// Safe server-side access
const config = Constants.expoConfig;
if (config) {
console.log("SSR-safe config access:", config.name);
}interface ExpoConfig {
name?: string;
slug?: string;
version?: string;
platforms?: string[];
ios?: {
bundleIdentifier?: string;
buildNumber?: string;
// ... other iOS config
};
android?: {
package?: string;
versionCode?: number;
// ... other Android config
};
web?: {
// ... web config
};
// ... many other configuration options
}interface ExpoUpdatesManifest {
id: string;
metadata: object;
createdAt: string;
runtimeVersion: string;
launchAsset: {
url: string;
};
assets: Array<{
url: string;
[key: string]: any;
}>;
extra?: {
expoClient?: ExpoConfig;
expoGo?: ExpoGoConfig;
eas?: EASConfig;
};
}interface EmbeddedManifest extends ExpoConfig {
// Embedded manifests extend ExpoConfig
// Legacy format for backwards compatibility
}