@babel/plugin-transform-react-jsx-source

NOTE: This plugin is included in @babel/preset-react

Example

In

  1. <sometag />

Out

  1. <sometag __source={ { fileName: 'this/file.js', lineNumber: 10, columnNumber: 1 } } />

The columnNumber is emitted since v7.9.0.

Installation

  1. npm install --save-dev @babel/plugin-transform-react-jsx-source

Usage

  1. {
  2. "plugins": ["@babel/plugin-transform-react-jsx-source"]
  3. }

Via CLI

  1. babel --plugins @babel/plugin-transform-react-jsx-source script.js

Via Node API

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