0.0.1 • Published 9 months ago

babel-plugin-transform-react-jsx-data-source-code-location v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

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"],
});
0.0.1

9 months ago