Registry / web-framework / babel-plugin-transform-react-stateless-component-name

babel-plugin-transform-react-stateless-component-name

JSON →
library1.1.2jsnpmunverified

A Babel plugin (v1.1.2) that automatically adds a `displayName` property to default-exported stateless (functional) React components, improving readability in React DevTools and snapshot test output. It also adds `displayName` to function declarations and variable assignments. Last released in 2017, this plugin is stable and no longer actively updated. It works with Babel 6.x. Alternatives include using `@babel/plugin-transform-react-display-name` for Babel 7+.

npm install babel-plugin-transform-react-stateless-component-name
INSTALL
IMPORT
SIG · BABEL-PLUGIN-TRANS
B
babel-plugin-transform-react-stateless-component-name
web-frameworkjavascriptv1.1.2
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
// No import needed; add to .babelrc plugins array
const plugin = require('babel-plugin-transform-react-stateless-component-name')
This is a Babel plugin, not a runtime import. It is configured in .babelrc or equivalent.

Shows adding the plugin to a .babelrc configuration file. No JavaScript import needed.

{ "plugins": ["transform-react-stateless-component-name"] }
Debug
Known issues
deprecatedThis plugin is designed for Babel 6.x and will not work with Babel 7 or later.
fix
Use @babel/plugin-transform-react-display-name instead.
affects: >=7.0
gotchaOnly adds displayName to default-exported stateless components, not to named exports or class components.
fix
Use a different plugin or manually add displayName for named exports.
affects: >=0.0
breakingv1.0.0 introduced breaking changes from previous non-existent versions; initial release.
fix
Update to v1.0.0 or later.
affects: <1.0.0
gotchaPlugin may crash on block-arrow components with HOC wrappers before v1.1.2.
fix
Update to v1.1.2 or later.
affects: <1.1.2
Errors
Common errors & fixes
Error: Couldn't find a preset or plugin with the name 'transform-react-stateless-component-name'.
Plugin not installed or configured incorrectly.
fix
Run `npm install --save-dev babel-plugin-transform-react-stateless-component-name` and ensure it's in the plugins array.
ReferenceError: require is not defined
Trying to use `require` in an ES module environment.
fix
This plugin is for Babel configuration, not runtime. Add to .babelrc without `require`.
Upgrade
Version history
1.1.2latest on npm
Audit
Dependencies
babel-corerequiredpeer dependency for Babel plugin system
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
babel-plugin-transform-react-stateless-component-name — npm install babel-plugin-transform-react-stateless-component-name · libregistry