-
-
Notifications
You must be signed in to change notification settings - Fork 5
Configuration Options
This page lists and explains all available configuration options for the nuxt-feature-flags-module in your nuxt.config.ts file.
The module is configured under the featureFlags key. This object must be added to your Nuxt configuration.
export default defineNuxtConfig({
modules: ['nuxt-feature-flags-module'],
featureFlags: {
environment: 'development',
flagSets: {
development: ['featureA'],
production: []
},
validation: {
mode: 'warn'
}
}
})The name of the current environment, used to determine which feature flags are active.
-
Example:
'production','staging','development' -
Usually driven by an environment variable:
environment: process.env.FEATURE_ENV || 'development'
Defines which flags are enabled for each environment. Each flag can be either a simple string or a full object with advanced options.
flagSets: {
development: [
'featureA',
{
name: 'featureB',
activeFrom: '2025-06-01T00:00:00Z',
activeUntil: '2025-07-01T00:00:00Z'
},
{
name: 'uiTest',
variants: ['a', 'b'],
distribution: [0.2, 0.8],
persistence: 'cookie'
}
]
}type FeatureFlagInput = string | FeatureFlaginterface FeatureFlag {
name: string
activeFrom?: string // ISO timestamp string (optional)
activeUntil?: string // ISO timestamp string (optional)
variants?: string[] // Optional A/B variants
distribution?: number[] // Probability per variant (must match length)
persistence?: 'state' | 'cookie' | 'local' // Variant storage method
}You can define time-based activation windows using ISO timestamps. The flag will only be considered "enabled" within this timeframe.
List of A/B test variants (e.g., ['control', 'treatment']). Requires:
-
distribution: Probability array (e.g.,[0.5, 0.5]) -
persistence: How the selected variant is stored
Persistence options for A/B variant storage:
-
'state': Vue state (default) -
'cookie': Shared between client/server -
'local':localStorage(client-only)
Enable validation of used feature flags during development/build time.
validation: {
mode: 'warn',
includeGlobs: ['**/*.{vue,ts,js}'],
excludeGlobs: ['node_modules', '.nuxt', 'dist']
}-
'disabled': Skip validation -
'warn'(default): Print console warnings -
'error': Throw build-time errors for undeclared or invalid flags
Which files to scan. Defaults to:
['**/*.{vue,ts,js}']Which paths to exclude from scanning. Defaults to:
['node_modules', '.nuxt', 'dist']