{"id":22854,"library":"vite-plugin-stripper","title":"vite-plugin-stripper","description":"A Vite plugin that strips out specified functions from your browser bundle, removing debug or development-only code in production. Current stable version is 0.10.1, released as part of the KitQL monorepo. It uses oxc (since v0.10.0) for fast parsing instead of babel/recast. Works with Vite 5, 6, 7, or 8. Key differentiator: lightweight, tree-shakable, and focused on stripping function calls, not entire files. Requires Node ^16.14 || >=18.","status":"active","version":"0.10.1","language":"javascript","source_language":"en","source_url":"https://github.com/jycouet/kitql","tags":["javascript","vite","vite-plugin","typescript"],"install":[{"cmd":"npm install vite-plugin-stripper","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-stripper","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-stripper","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: plugin runs as a Vite plugin","package":"vite","optional":false}],"imports":[{"note":"ESM-only; CJS require will fail.","wrong":"const vitePluginStripper = require('vite-plugin-stripper')","symbol":"vitePluginStripper","correct":"import vitePluginStripper from 'vite-plugin-stripper'"},{"note":"Type import; available since 0.10.0.","symbol":"StripperOptions","correct":"import type { StripperOptions } from 'vite-plugin-stripper'"},{"note":"The default export is the plugin function; named export does not exist.","wrong":"import { vitePluginStripper } from 'vite-plugin-stripper'","symbol":"default (plugin function)","correct":"import vitePluginStripper from 'vite-plugin-stripper'\nexport default { plugins: [vitePluginStripper()] }"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite'\nimport vitePluginStripper from 'vite-plugin-stripper'\n\nexport default defineConfig({\n  plugins: [\n    vitePluginStripper({\n      strip: ['console.log', 'debug', 'myCustomDebug'],\n      include: ['src/**/*.ts'],\n      exclude: ['node_modules/**'],\n      sourcemap: true\n    })\n  ]\n})","lang":"typescript","description":"Configures vite-plugin-stripper to remove console.log, debug, and myCustomDebug from source files in production build."},"warnings":[{"fix":"Remove usage of `log_on_throw_is_not_a_new_class`. If needed, open a GitHub issue to request re-implementation.","message":"Since v0.10.0, the option `log_on_throw_is_not_a_new_class` has been removed.","severity":"breaking","affected_versions":">=0.10.0"},{"fix":"Test your build after upgrading; verify that targeted functions are still stripped correctly.","message":"Parsing engine changed from babel/recast to oxc in v0.10.0, which may produce different AST results and potentially different stripping behavior.","severity":"breaking","affected_versions":">=0.10.0"},{"fix":"To test in dev, set `apply: 'build'` or use `apply: (config, { command }) => command === 'build'` in plugin options.","message":"The plugin is only active in production builds by default. It does not strip functions in dev mode.","severity":"gotcha","affected_versions":"*"},{"fix":"Upgrade to vite-plugin-stripper@^0.10.0.","message":"If using Vite 5, ensure vite-plugin-stripper version is at least 0.10.0 (which supports Vite 5). Older versions may not work.","severity":"gotcha","affected_versions":"<0.10.0"},{"fix":"Use Node 18 or later for security and performance.","message":"Node 16 support is deprecated as of v0.10.0? The engine field allows ^16.14, but Node 16 is end-of-life.","severity":"deprecated","affected_versions":">=0.10.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Change to import statement or use dynamic import().","cause":"Using CommonJS require() to import an ESM-only package.","error":"require() of ES Module /path/to/node_modules/vite-plugin-stripper/dist/index.mjs not supported"},{"fix":"Install vite: npm install -D vite","cause":"Missing peer dependency 'vite'.","error":"ERR_MODULE_NOT_FOUND: Cannot find package 'vite'"},{"fix":"Use import vitePluginStripper from 'vite-plugin-stripper' (no curly braces).","cause":"Using named import instead of default import.","error":"TypeError: vitePluginStripper is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}