File: patch-project.md | Updated: 11/15/2025
Hide navigation
Search
Ctrl K
Home Guides EAS Reference Learn
Archive Expo Snack Discord and Forums Newsletter
Copy page
Learn about how to use patch-project to create generate, apply, and preserve native changes in your Expo project.
Copy page
Note:
patch-projectis an experimental feature.
patch-project is an Expo config plugin and command-line interface (CLI) tool that generates and applies patches to preserve native changes after running npx expo prebuild. This tool is useful for native app developers who want to preserve customizations without needing to know how to write a config plugin, effectively generating an automatic solution that works with Continuous Native Generation (CNG)
.
This guide explains how to use patch-project, when to use it, and its limitations.
patch-project uses an approach to generate and automatically apply patches, which is inspired by Git. Using this command line tool requires the following steps in your project:
To get started, you need to install the tool in your project:
Terminal
Copy
-Ā npx expo install patch-project
This command will automatically add the patch-project config plugin to your app config
:
app.json
Copy
{ "expo": { "plugins": [ "patch-project" %%placeholder-start%% ...%%placeholder-end%% ] } }
Let's assume you manually modified native directories (android and ios) in your project. To generate patches for these native directories, you can run the following command:
Terminal
Copy
-Ā npx patch-project
Note: In scenarios where you want to generate patches for a specific platform, you can use the
--platformoption and runnpx patch-project --platform androidornpx patch-project --platform ios.
These patches, when generated, are saved in the cng-patches directory.
.
āapp.json``with patch-project plugin
ācng-patches
āāandroid+eee880ad7b07965271d2323f7057a2b4.patch``patch for android directory
āāios+eee880ad7b07965271d2323f7057a2b4.patch``patch for ios directory
āpackage.json
ā...``other project files
Each file will be prefixed with a platform's name followed by a checksum value. For example:
ios+eee880ad7b07965271d2323f7057a2b4.patch
Once you have generated patches, they are automatically applied when subsequently running the npx expo prebuild command. The patch-project config plugin detects the existing patches and applies them to restore your customizations.
You can use patch-project in the following scenarios:
npx expo prebuild command subsequently. This is an advantage over tools like patch-package (commonly used for generating patches for npm libraries), which do not preserve and automatically apply patches during the prebuild process.Limitations and considerations
Patches may become invalid during Expo SDK version upgrades because:
npx expo prebuild --clean can change these IDs. For example, if you're adding a widget extension or making other project configuration changes, patch-based approaches may not work reliably. You can review the generated cng-patches/ios-* and keep only the necessary patch. Having the patch as minimal as possible would reduce the risk of failures when applying patches.It is recommended to regenerate patches after each SDK upgrade.