babel-plugin-transform-react-jsx-data-source-code-location

0.0.1 • Public • Published

babel-plugin-transform-react-jsx-data-source-code-location

npm

Add data-source-code-location to all JSX Elements.

English | 简体中文

Example

In

<sometag />

Out

<sometag data-__source-code-location={`${__jsxFileName}:${lineNumber}:${columnNumber}`} />

Install

Using npm:

npm install --save-dev babel-plugin-transform-react-jsx-data-source-code-location

or using yarn:

yarn add babel-plugin-transform-react-jsx-data-source-code-location --dev

Usage

With a configuration file (Recommended)

{
  "plugins": ["babel-plugin-transform-react-jsx-data-source-code-location"]
}

Via CLI

babel --plugins babel-plugin-transform-react-jsx-data-source-code-location script.js

Via Node API

require("@babel/core").transformSync("code", {
  plugins: ["babel-plugin-transform-react-jsx-data-source-code-location"],
});

Readme

Keywords

Package Sidebar

Install

npm i babel-plugin-transform-react-jsx-data-source-code-location

Weekly Downloads

5

Version

0.0.1

License

MIT

Unpacked Size

9.4 kB

Total Files

16

Last publish

Collaborators

  • zjffun