Registry /
devops / babel-plugin-feature-flags
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
babel-plugin-feature-flags
✓ module.exports = {
plugins: [
['feature-flags', { import: { module: 'my-features' }, features: { 'new-feature': 'disabled' } }]
]
};
✗ import babelPluginFeatureFlags from 'babel-plugin-feature-flags';
This is a Babel plugin, used in .babelrc or babel.config.js — not imported directly in source code.
default import of feature function
✓ import isEnabled from 'my-features';
✗ import { isEnabled } from 'my-features';
The default import name is configurable via options.import.name (default is 'default'). If using a named import, set options.import.name to the export name.
feature flags configuration
✓ {
'my-feature': 'enabled',
'beta-feature': 'disabled',
'experimental': 'dynamic'
}
✗ {
'my-feature': 'true',
'beta-feature': false
}
Values must be exactly the strings 'enabled', 'disabled', or 'dynamic'. Booleans or other strings will not work.
Configures feature flags via .babelrc with enabled/disabled/dynamic values and shows transformation of flag calls.
// .babelrc
{
"plugins": [["feature-flags", {
"import": {
"module": "@app/features"
},
"features": {
"new-checkout": "enabled",
"dark-mode": "disabled",
"payment-v2": "dynamic"
}
}]]
}
// source.js
import feature from '@app/features';
if (feature('new-checkout')) {
console.log('New checkout flow');
}
if (feature('dark-mode')) {
document.body.classList.add('dark');
}
if (feature('payment-v2')) {
// runtime check left intact
}
// after babel transform:
if (true) {
console.log('New checkout flow');
}
// if (false) block removed by dead code elimination
if (feature('payment-v2')) {}
Errors
Common errors & fixes
Error: Cannot find module 'babel-plugin-feature-flags'
Plugin not installed or babel version mismatch (Babel 7 vs Babel 6).
fixnpm install babel-plugin-feature-flags@0.3.1 --save-dev and ensure babel-core version 6.x.
ReferenceError: isEnabled is not defined
The import of the feature function is not present in the source file, but the call expression is still there after transform.
fixAdd the correct import (e.g., import isEnabled from 'my-features';) matching the options.import.module.
Audit
Dependencies
No dependency data recorded yet.