Registry / devops / babel-plugin-react-remove-classname

babel-plugin-react-remove-classname

JSON →
library1.0.0jsnpmunverified

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).

npm install babel-plugin-react-remove-classname
INSTALL
IMPORT
SIG · BABEL-PLUGIN-REACT
B
babel-plugin-react-remove-classname
devopsjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default plugin
module.exports = { plugins: ['react-remove-classname'] }
Used in .babelrc or babel.config.js as a string reference.
with options
const plugin = require('babel-plugin-react-remove-classname'); module.exports = { plugins: [[plugin, { prefix: 'e2e-' }]] }
module.exports = { plugins: ['babel-plugin-react-remove-classname'] }
Specify options using array syntax with the required module.
ESM import (for tools that support it)
import removeClassname from 'babel-plugin-react-remove-classname'; export default { plugins: [[removeClassname, { prefix: 'test-' }]] }
import { reactRemoveClassname } from 'babel-plugin-react-remove-classname'
The plugin is CommonJS only; ESM import is a default import.

Configure Babel to remove class names starting with 'test-' from JSX className attributes.

// .babelrc { "plugins": [ ["react-remove-classname", { "prefix": "test-" }] ] } // Input: <div className="test-a hello test-b"></div> // Output: <div className="hello"></div>
Debug
Known issues
breakingv1.0.0 drops support for Node.js <6 and requires Babel 7.
fix
Upgrade to Babel 7 and Node.js >=6, and update .babelrc to use 'react-remove-classname' (no babel-plugin- prefix) for Babel 7.
affects: >=0.x <1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'babel-plugin-react-remove-classname'
Plugin not installed or not in node_modules.
fix
Run npm install --save-dev babel-plugin-react-remove-classname
ReferenceError: [BABEL] unknown: Unknown option: .prefix
Incorrect configuration format in .babelrc.
fix
Use array syntax: ["react-remove-classname", { "prefix": "custom-" }]
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
babel-plugin-react-remove-classname — npm install babel-plugin-react-remove-classname · libregistry