Gathering detailed insights and metrics for expo-build-flags
Gathering detailed insights and metrics for expo-build-flags
Gathering detailed insights and metrics for expo-build-flags
Gathering detailed insights and metrics for expo-build-flags
A module to make feature-flagging easier for expo projects
npm install expo-build-flags
Typescript
Module System
Node Version
NPM Version
TypeScript (62.65%)
JavaScript (28.56%)
Ruby (5.27%)
Shell (3.53%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1 Stars
45 Commits
1 Watchers
3 Branches
1 Contributors
Updated on May 11, 2025
Latest Version
0.7.0
Package Id
expo-build-flags@0.7.0
Unpacked Size
31.15 kB
Size
9.37 kB
File Count
32
NPM Version
9.8.1
Node Version
18.18.2
Published on
Nov 04, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A module to make feature-flagging easier for expo projects.
This module is in active development and is not stable or well documented yet.
yarn add expo-build-flags
Add a flags file to the root of your repo in the form of the test example, or run yarn build-flags init
.
Run yarn build-flags override +secretFeature -newFeature
sometime before your bundle server or build start to generate the runtime typescript module. This path is defined by mergePath
and you should add it to your project gitignore.
The arguments after the override command are the flags you want to +
enable or -
disable. No comparison with the default value is done, so if it's already enabled and you +enable
it, it's a no-op.
You can run yarn build-flags ota-override
instead of "override" to do the same but also consider the branch name in two supported CI environments: Github and Gitlab. Use the ota.branches
array in the flags.yml to setup that matching and branch-based enablement.
To set flags for EAS builds, set the EXPO_BUILD_FLAGS
environment variable in eas.json
for your profile. This value will be available to the config plugin at build time in EAS when you add it to your app.json
plugins array:
1{ 2 "expo": { 3+ "plugins": ["expo-build-flags"] 4 } 5}
Using the EXPO_BUILD_FLAGS
environment variable, the config plugin will:
<meta-data android:name="EXBuildFlags" />
tag to your AndroidManifest.xmlEXBuildFlags
array to your Info.plistThe variable value is a comma-separated list of flag names you want to enable, ie: EXPO_BUILD_FLAGS=newFeature,secretFeature
.
To benefit from tree shaking, add the babel plugin to your project's babel config:
1{ 2 presets: ["babel-preset-expo"], 3 plugins: [ 4+ ["expo-build-flags/babel-plugin", { flagsModule: "./constants/buildFlags.ts" }], 5 ], 6}
The flagsModule
path must match the runtime mergePath
in your committed flags.yml file. This plugin replaces the BuildFlags
imports with the literal boolean values which allows the build pipeline to strip unreachable paths.
If your feature relies on native module behaviour, you may want to avoid linking that module if the build flag is off. To do so, specify the absolute name or relative path to the module in the base definition for your flag:
Example for flags.yml definition:
1flags: 2 featureWithNativeStuff: 3 value: false 4 modules: 5 - react-native-device-info
In the above example, react-native-device-info
would be excluded from autolinking. If you want to allow builds to occur on a specific branch, you can specify it:
1modules: 2 - react-native-device-info: 3 branch: some-branch-with-build
Locally-referenced modules aren't currently supported (until this 'exclude' exclusion can be overridden).
No vulnerabilities found.
No security vulnerabilities found.