babel-plugin-transform-react-jsx-data-source-code-location
v0.0.1
Published
Add data-__source-code-location to all JSX Elements.
Downloads
59
Readme
babel-plugin-transform-react-jsx-data-source-code-location
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"],
});