Skip to content

Vite Plugin

featureTogglesPlugin() — automatically strips <FeatureDevTools> and its import from all source files during production builds, so no v-if="isDev" wrapper is needed around it.

ts
function featureTogglesPlugin(options?: FeatureTogglesPluginOptions): Plugin
ts
// vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { featureTogglesPlugin } from 'vue-feature-toggles/vite'

export default defineConfig({
  plugins: [vue(), featureTogglesPlugin()],
})

Only active for vite build (a no-op during vite dev). Runs as an enforce: 'pre' transform, so its position in the plugins array relative to @vitejs/plugin-vue doesn't matter.

Options

stripDevTools

boolean · default: true

Remove <FeatureDevTools> usage (both the template tag and its import statement) from templates in production builds.