or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.mdperformance-optimizations.mdplatform-options.mdpreset-configuration.mdreact-compiler.mdserver-components.md
tile.json

platform-options.mddocs/

Platform Options

Configuration options for customizing babel-preset-expo behavior per platform or globally.

Capabilities

Platform Options Interface

Core configuration interface for all platform-specific settings.

interface BabelPresetExpoPlatformOptions {
  /** Disable or configure the @babel/plugin-proposal-decorators plugin */
  decorators?: false | { legacy?: boolean; version?: number };
  /** Enable or disable adding the Reanimated plugin by default (default: true) */
  reanimated?: boolean;
  /** Enable or disable adding the Worklets plugin by default (default: true) */
  worklets?: boolean;
  /** @deprecated Use jsxRuntime: 'classic' instead */
  useTransformReactJSXExperimental?: boolean;
  /** Change the policy for handling JSX (default: 'automatic') */
  jsxRuntime?: 'classic' | 'automatic';
  /** JSX import source when using automatic runtime (default: 'react') */
  jsxImportSource?: string;
  /** Enable lazy imports for better startup performance */
  lazyImports?: boolean;
  /** Disable import/export transform for tree shaking */
  disableImportExportTransform?: boolean;
  /** Disable deep import warnings */
  disableDeepImportWarnings?: boolean;
  /** Disable Flow type stripping transform */
  disableFlowStripTypesTransform?: boolean;
  /** Enable or configure Babel runtime transform */
  enableBabelRuntime?: boolean | string;
  /** Transform profile for Hermes optimization */
  unstable_transformProfile?: 'default' | 'hermes-stable' | 'hermes-canary';
  /** React Compiler configuration */
  'react-compiler'?: false | ReactCompilerOptions;
  /** Enable typeof window runtime checks optimization */
  minifyTypeofWindow?: boolean;
  /** Enable import.meta transform to globalThis registry */
  unstable_transformImportMeta?: boolean;
}

JSX Configuration

Controls how JSX is transformed in the build process.

interface JSXOptions {
  /** JSX transformation mode */
  jsxRuntime?: 'classic' | 'automatic';
  /** JSX import source for automatic runtime */
  jsxImportSource?: string;
}

Usage Examples:

// Use React 17+ automatic JSX (default)
module.exports = {
  presets: [
    ['babel-preset-expo', {
      jsxRuntime: 'automatic'
    }]
  ]
};

// Use classic JSX requiring React imports
module.exports = {
  presets: [
    ['babel-preset-expo', {
      jsxRuntime: 'classic'
    }]
  ]
};

// Use custom JSX import source (e.g., Preact)
module.exports = {
  presets: [
    ['babel-preset-expo', {
      jsxRuntime: 'automatic',
      jsxImportSource: 'preact'
    }]
  ]
};

Plugin Control

Enable or disable specific Babel plugins included in the preset.

interface PluginControlOptions {
  /** Enable Reanimated plugin (default: true) */
  reanimated?: boolean;
  /** Enable Worklets plugin (default: true) */
  worklets?: boolean;
  /** Configure decorators plugin */
  decorators?: false | { legacy?: boolean; version?: number };
}

Usage Examples:

// Disable Reanimated plugin
module.exports = {
  presets: [
    ['babel-preset-expo', {
      reanimated: false
    }]
  ]
};

// Configure decorators with TypeScript 5 support
module.exports = {
  presets: [
    ['babel-preset-expo', {
      decorators: { legacy: false, version: 2023 }
    }]
  ]
};

Performance Options

Configure build-time optimizations and transformations.

interface PerformanceOptions {
  /** Enable lazy imports for better startup performance */
  lazyImports?: boolean;
  /** Disable import/export transform for tree shaking */
  disableImportExportTransform?: boolean;
  /** Transform profile for Hermes JavaScript engine */
  unstable_transformProfile?: 'default' | 'hermes-stable' | 'hermes-canary';
  /** Optimize typeof window checks */
  minifyTypeofWindow?: boolean;
}

Usage Examples:

// Enable lazy imports on native platforms
module.exports = {
  presets: [
    ['babel-preset-expo', {
      native: {
        lazyImports: true
      }
    }]
  ]
};

// Optimize for Hermes engine
module.exports = {
  presets: [
    ['babel-preset-expo', {
      native: {
        unstable_transformProfile: 'hermes-stable'
      }
    }]
  ]
};

// Enable tree shaking on web
module.exports = {
  presets: [
    ['babel-preset-expo', {
      web: {
        disableImportExportTransform: true
      }
    }]
  ]
};

Development Options

Configure development-specific features and transformations.

interface DevelopmentOptions {
  /** Disable Flow type stripping */
  disableFlowStripTypesTransform?: boolean;
  /** Enable or configure Babel runtime */
  enableBabelRuntime?: boolean | string;
  /** Disable deep import warnings */
  disableDeepImportWarnings?: boolean;
}

Platform-Specific Defaults

The preset applies different defaults based on the target platform:

Web Platform Defaults:

  • disableImportExportTransform: true (for tree shaking)
  • minifyTypeofWindow: false (for Web Worker compatibility)

Native Platform Defaults:

  • disableImportExportTransform: false (Metro doesn't support ESM)
  • unstable_transformProfile: 'hermes-stable' (when Hermes detected)

Server Platform Defaults:

  • unstable_transformImportMeta: true (import.meta polyfill)
  • minifyTypeofWindow: true (typeof window optimization)