Skip to content
useffect.sh
Book 30 min with a senior
Tooling

Config plugin

A JavaScript function declared in app.json that modifies the native projects prebuild generates (Info.plist, manifest, Gradle, Podfile).

Definition

A config plugin is a JavaScript function, declared in the plugins array of the Expo configuration (app.json or app.config.ts), that modifies the native projects while npx expo prebuild generates them. It handles what the standard app.json properties do not cover: adding a key to Info.plist, a permission or intent filter to AndroidManifest.xml, a line in the Podfile or build.gradle, an Xcode target. The plugin applies mods (withInfoPlist, withAndroidManifest, withDangerousMod, and so on) provided by expo/config-plugins, each targeting one native file. It replaces hand edits to the android and ios folders, which would be lost at the next regeneration. Most native libraries ship their own plugin (an app.plugin.js file); you write one when a library has none or for an app-specific change. The text of the camera permission prompt, for instance, is set through expo-camera’s plugin.

In a real app

In app.json, a plugin is declared by package name or local path, with optional options: ["expo-camera", { "cameraPermission": "…" }]. A very common one is expo-build-properties, which sets minSdkVersion, deploymentTarget, or useFrameworks without touching native files. A local plugin usually lives in plugins/withSomething.ts and is registered by relative path.

Typical mistakes: a plugin declared for an uninstalled package (prebuild stops with an error, by design), a mod that rewrites a whole file instead of modifying it (later mods lose their changes), and withDangerousMod running regexes over the Podfile or MainActivity.kt that break as soon as the template changes with a new SDK. A plugin is also evaluated every time the config is read, not only at prebuild; slow side effects (network reads, shelling out) slow down expo start and EAS.

To confirm a plugin does what you think: npx expo prebuild --clean followed by git diff on a project where the native folders are temporarily committed, or npx expo config --type introspect to see the mods’ output without generating. Plugins are tested with expo-module-scripts and snapshots of native files.

Our services on this

Sources

All 35 glossary terms

One of these is blocking your app?

30 minutes with a senior to look at the problem in your code. Free.