or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

build-cache.mdconfiguration.mdindex.mdpaths.mdsdk-version.md
tile.json

tessl/npm-expo--config

A library for interacting with the app.json configuration files in Expo projects

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@expo/config@12.0.x

To install, run

npx @tessl/cli install tessl/npm-expo--config@12.0.0

index.mddocs/

@expo/config

@expo/config provides comprehensive configuration management for Expo applications. It enables developers to parse, validate, and manipulate app.json and expo configuration files with support for both static and dynamic configurations, plugin systems, and workspace-aware path resolution.

Package Information

  • Package Name: @expo/config
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install @expo/config

Core Imports

import { getConfig, getPackageJson, getExpoSDKVersion } from "@expo/config";

For CommonJS:

const { getConfig, getPackageJson, getExpoSDKVersion } = require("@expo/config");

Path utilities (separate entry point):

import { resolveEntryPoint, getBareExtensions } from "@expo/config/paths";

Basic Usage

import { getConfig, getExpoSDKVersion } from "@expo/config";

// Read Expo project configuration
const projectRoot = "/path/to/expo-project";
const config = getConfig(projectRoot);

console.log("App name:", config.exp.name);
console.log("App slug:", config.exp.slug);
console.log("SDK version:", config.exp.sdkVersion);

// Get just the package.json
const packageJson = getPackageJson(projectRoot);

// Get SDK version explicitly
const sdkVersion = getExpoSDKVersion(projectRoot, config.exp);

Architecture

@expo/config is built around several key components:

  • Configuration Engine: Core system for reading and processing app.json, app.config.js/ts files
  • Dynamic Config Support: Evaluation of function-based configurations with context injection
  • Plugin System: Integration with @expo/config-plugins for configuration transformations
  • Path Resolution: Workspace-aware utilities for entry point and file resolution
  • Type System: Complete TypeScript definitions for all Expo configuration schemas
  • SDK Integration: Automatic Expo SDK version detection and validation

Capabilities

Configuration Management

Core functionality for reading, parsing, and modifying Expo project configurations. Supports both static (JSON) and dynamic (JavaScript/TypeScript) configuration files.

function getConfig(projectRoot: string, options?: GetConfigOptions): ProjectConfig;

interface ProjectConfig {
  exp: ExpoConfig;
  mods?: ModConfig | null;
  pkg: PackageJSONConfig;
  rootConfig: AppJSONConfig;
  staticConfigPath: string | null;
  dynamicConfigPath: string | null;
  dynamicConfigObjectType: string | null;
  hasUnusedStaticConfig: boolean;
}

interface GetConfigOptions {
  isPublicConfig?: boolean;
  isModdedConfig?: boolean;
  skipSDKVersionRequirement?: boolean;
  skipPlugins?: boolean;
  strict?: boolean;
}

Configuration Management

Path Resolution

Utilities for resolving entry points and file extensions in Expo projects, with support for monorepos and platform-specific files.

function resolveEntryPoint(
  projectRoot: string,
  options?: { platform?: string; pkg?: PackageJSONConfig }
): string;

function getBareExtensions(
  platforms: string[],
  languageOptions?: LanguageOptions
): string[];

Path Resolution

SDK Version Resolution

Automatic detection and validation of Expo SDK versions from configuration or installed packages.

function getExpoSDKVersion(
  projectRoot: string,
  exp?: Pick<ExpoConfig, 'sdkVersion'>
): string;

SDK Version Resolution

Build Cache Integration

Type definitions and interfaces for build caching systems used in Expo development workflows.

interface BuildCacheProvider<T = any> {
  plugin: BuildCacheProviderPlugin<T>;
  options: T;
}

type RunOptions = AndroidRunOptions | IosRunOptions;

Build Cache Integration

Common Types

// Core configuration types
interface ExpoConfig {
  name?: string;
  slug?: string;
  version?: string;
  sdkVersion?: string;
  platforms?: Platform[];
  description?: string;
  plugins?: any[];
  // ... extensive additional properties
}

interface PackageJSONConfig {
  dependencies?: Record<string, string>;
  [key: string]: any;
}

interface AppJSONConfig {
  expo: ExpoConfig;
  [key: string]: any;
}

// Utility types
type Platform = 'android' | 'ios' | 'web';
type ProjectTarget = 'managed' | 'bare';

interface ConfigFilePaths {
  staticConfigPath: string | null;
  dynamicConfigPath: string | null;
}

// Error handling
class ConfigError extends Error {
  readonly name: 'ConfigError';
  readonly isConfigError: true;
  code: ConfigErrorCode;
  cause?: Error;
}

type ConfigErrorCode =
  | 'NO_APP_JSON'
  | 'NOT_OBJECT' 
  | 'NO_EXPO'
  | 'MODULE_NOT_FOUND'
  | 'DEPRECATED'
  | 'INVALID_MODE'
  | 'INVALID_FORMAT'
  | 'INVALID_PLUGIN'
  | 'INVALID_CONFIG'
  | 'ENTRY_NOT_FOUND';