Api

Configuration

Last updated by
Harlan Wilton
in doc: sync.

Complete configuration options for nuxt.config.ts.

Basic Configuration

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['nuxt-skew-protection'],

  skewProtection: {
    // Your configuration here
  }
})

Options

enabled: boolean

  • Default: true

Enable or disable the module.

skewProtection: {
  enabled: process.env.NODE_ENV === 'production'
}

storage: StorageOptions

  • Default: { driver: 'fs', base: 'node_modules/.cache/nuxt/skew-protection' }

Storage configuration for version assets and metadata. Required for production.

export default defineNuxtConfig({
  skewProtection: {
    storage: {
      driver: 'fs', // or 'redis', 's3', 'cloudflare-kv-binding', etc.
      // Driver-specific options
    }
  }
})

See Storage Configuration for all drivers.

checkForUpdateStrategy: 'polling' | 'sse' | 'ws'

  • Default: Auto-detected based on platform

Strategy for checking for version updates.

skewProtection: {
  checkForUpdateStrategy: 'sse'
}

Auto-detection:

  • Static sites → 'polling'
  • Cloudflare Durable → 'ws'
  • Node.js/Bun/Deno → 'sse'

See Update Strategies for details.

retentionDays: number

  • Default: 30

How many days to keep old versions before cleanup.

skewProtection: {
  retentionDays: 7 // Keep versions for 7 days
}

maxNumberOfVersions: number

  • Default: 10

Maximum number of versions to retain.

skewProtection: {
  maxNumberOfVersions: 5 // Keep max 5 versions
}

Cleanup happens during build. Oldest versions are removed first.

  • Default: See below

Cookie configuration for storing deployment version.

export default defineNuxtConfig({
  skewProtection: {
    cookie: {
      name: '__nkpv',
      path: '/',
      sameSite: 'strict',
      maxAge: 60 * 60 * 24 * 60 // 60 days
    }
  }
})

bundlePreviousDeploymentChunks: boolean

  • Default: true

Bundle previous deployment chunks to support users on old versions. When enabled, old build assets are stored and served to users who haven't refreshed.

skewProtection: {
  bundlePreviousDeploymentChunks: true
}
Automatically disabled when using CDN URL.

debug: boolean

  • Default: false

Enable debug logging.

skewProtection: {
  debug: true
}

Logs version changes, asset operations, module invalidations, and storage operations.

Did this page help you?