or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.mdmanifests-config.md
tile.json

manifests-config.mddocs/

Manifests and Configuration

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.

Capabilities

Expo Config Access

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);
  }
}

Legacy Manifest Access

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);
}

Modern Manifest Access

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);
  }
}

Expo Go Configuration

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
}

EAS Configuration

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
}

Manifest Resolution Priority

Expo Constants follows a specific priority order when resolving manifests:

  1. Expo Updates: If expo-updates provides a non-empty manifest, it takes precedence
  2. Dev Launcher: If EXDevLauncher provides a manifest, it's used next
  3. ExponentConstants: Falls back to the embedded manifest from ExponentConstants
// 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");
}

Error Handling

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);
  }
}

Platform-Specific Considerations

Web Environment

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);
}

React Server Components

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);
}

Types

ExpoConfig

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
}

ExpoUpdatesManifest

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;
  };
}

EmbeddedManifest

interface EmbeddedManifest extends ExpoConfig {
  // Embedded manifests extend ExpoConfig
  // Legacy format for backwards compatibility
}