0Pricing
React Native Academy · Lesson

Distributing Config Plugins as npm Packages

Package your config plugin as an npm module, add an app.plugin.js entry point, publish to npm, and install it in another Expo project to verify it applies correctly.

Why Package a Config Plugin

If you use the same config plugin across multiple Expo projects, or want to share it with the React Native community, packaging it as an npm module makes distribution easy. Consumers install it with npm install and reference it by package name in app.json. Expo automatically discovers the app.plugin.js file at the package root without any extra configuration from the consumer.

Structuring the npm Package

A config plugin npm package has a minimal structure: a package.json, an app.plugin.js entry point at the package root (this is the file Expo looks for), and optionally a src/ folder for TypeScript source that compiles to the plugin file. The app.plugin.js filename is the Expo convention — do not name it differently or Expo cannot auto-discover it.

# Package structure
expo-plugin-my-sdk/
  app.plugin.js         <- Expo auto-discovers this
  index.js              <- optional JS API exports
  package.json
  README.md

# Or with TypeScript build:
expo-plugin-my-sdk/
  src/
    withMyPlugin.ts
    index.ts
  build/
    withMyPlugin.js     <- compiled output
  app.plugin.js         <- re-exports from build/
  package.json

All lessons in this course

  1. What Are Config Plugins and When to Use Them
  2. Writing Your First Config Plugin
  3. Modifying AndroidManifest and Info.plist
  4. Distributing Config Plugins as npm Packages
← Back to React Native Academy