{"id":19138,"library":"babel-plugin-react-remove-classname","title":"babel-plugin-react-remove-classname","description":"A Babel plugin (v1.0.0, last updated 2018) that removes CSS class names from JSX className attributes based on a configurable prefix (default \"test-\"). Useful for stripping test-only classes in production builds. Minimal configuration, no dependencies. Works with Babel 7 (v1.x) and Babel 6 (v0.x).","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/akameco/babel-plugin-react-remove-classname","tags":["javascript","babel","babel-plugin","ast"],"install":[{"cmd":"npm install babel-plugin-react-remove-classname","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-react-remove-classname","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-react-remove-classname","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Used in .babelrc or babel.config.js as a string reference.","symbol":"default plugin","correct":"module.exports = { plugins: ['react-remove-classname'] }"},{"note":"Specify options using array syntax with the required module.","wrong":"module.exports = { plugins: ['babel-plugin-react-remove-classname'] }","symbol":"with options","correct":"const plugin = require('babel-plugin-react-remove-classname'); module.exports = { plugins: [[plugin, { prefix: 'e2e-' }]] }"},{"note":"The plugin is CommonJS only; ESM import is a default import.","wrong":"import { reactRemoveClassname } from 'babel-plugin-react-remove-classname'","symbol":"ESM import (for tools that support it)","correct":"import removeClassname from 'babel-plugin-react-remove-classname'; export default { plugins: [[removeClassname, { prefix: 'test-' }]] }"}],"quickstart":{"code":"// .babelrc\n{\n  \"plugins\": [\n    [\"react-remove-classname\", { \"prefix\": \"test-\" }]\n  ]\n}\n\n// Input: <div className=\"test-a hello test-b\"></div>\n// Output: <div className=\"hello\"></div>","lang":"javascript","description":"Configure Babel to remove class names starting with 'test-' from JSX className attributes."},"warnings":[{"fix":"Upgrade to Babel 7 and Node.js >=6, and update .babelrc to use 'react-remove-classname' (no babel-plugin- prefix) for Babel 7.","message":"v1.0.0 drops support for Node.js <6 and requires Babel 7.","severity":"breaking","affected_versions":">=0.x <1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install --save-dev babel-plugin-react-remove-classname","cause":"Plugin not installed or not in node_modules.","error":"Error: Cannot find module 'babel-plugin-react-remove-classname'"},{"fix":"Use array syntax: [\"react-remove-classname\", { \"prefix\": \"custom-\" }]","cause":"Incorrect configuration format in .babelrc.","error":"ReferenceError: [BABEL] unknown: Unknown option: .prefix"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}