A Babel plugin that automatically adds displayName to observer-wrapped components, primarily for use with mobx-react-lite. Version 0.0.2, last updated in 2022. Unlike manual displayName assignment, this plugin automatically detects observer calls and injects the displayName in development mode via process.env.NODE_ENV === 'development'. It only supports named function expressions and const declarations with arrow functions. No configuration required beyond adding to Babel plugins.
npm install babel-plugin-react-observer-displaynameNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to install the plugin and the transformation it performs on observer-wrapped components.
Ensure components are defined as 'const MyComponent = observer(...)' or 'function MyComponent() { ... }' wrapped in observer.No fix needed; this is intentional for production bundle size.
Wrap displayName plugin after other HoCs or manually set displayName.
Use named exports or const declarations.
Ensure this plugin runs after other observer-related plugins.
Use 'const MyComponent = observer(...)' or 'function MyComponent() { ... }' and import observer from 'mobx-react-lite'.Check Babel configuration and set NODE_ENV=development.
Ensure NODE_ENV is set to 'production' in production builds and that the conditional is not eliminated by other plugins.
Run 'npm install babel-plugin-react-observer-displayname --save-dev' and ensure it's listed in Babel config.
No dependency data recorded yet.