Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jacobp100/babel-plugin-react-displayname-path

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jacobp100/babel-plugin-react-displayname-path

Babel plugin to display React components names with file path prefix

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-react-displayname-path

Part of the TechniCalc Project

Babel plugin to display React components names with file path prefix. Automatically detects and sets displayName property for React components.

This is useful for having meaningful component names show up in production builds of React apps.

This will work for top level functions that return JSX.

  • Function declarations via functionName.displayName = 'DisplayName'
  • Arrow functions and function expressions via Object.assign(() => {...}, { displayName: 'DisplayName' })

Class components are not supported.

Install

  • yarn add @jacobp100/babel-plugin-react-displayname-path
  • Add @jacobp100/react-displayname-path to your babel.config.js file:
const plugins = ["@jacobp100/react-displayname-path"];

Troubleshooting

If displayName isn't added, make sure the plugin placed before other plugins in your plugins list.

Motivation

Component stack traces are useless in production build:

    in b
    in li
    in ul
    in v
    in div
    in div
    in i
    in div
    in Unknown
    in t…

FAQs

Package last updated on 11 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc