Babel 6 JSX Transform Plugin

6.24.1 · abandoned · verified Sun Apr 19

This package, `babel-plugin-transform-react-jsx` version 6.24.1, is the legacy plugin for transforming JSX syntax into `React.createElement` calls (or custom pragma calls) within Babel 6 projects. It was the standard way to process JSX for JavaScript applications using Babel's previous major version. This plugin is no longer actively maintained and has been superseded by `@babel/plugin-transform-react-jsx` (and often integrated via `@babel/preset-react`) in Babel 7 and later. Projects currently on Babel 7 or 8 should use the scoped `@babel/plugin-transform-react-jsx` to ensure compatibility with modern React runtimes (classic or automatic) and the latest JavaScript features. This package is relevant only for maintaining older codebases that are specifically pinned to Babel 6.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to set up `babel-plugin-transform-react-jsx` in a Babel 6 project to transform JSX syntax, including `pragma` and `useBuiltIns` options, for a simple React component.

{
  "name": "my-babel-6-app",
  "version": "1.0.0",
  "devDependencies": {
    "babel-cli": "^6.0.0",
    "babel-core": "^6.0.0",
    "babel-plugin-transform-react-jsx": "^6.0.0"
  },
  "scripts": {
    "build": "babel src --out-dir lib"
  }
}

// .babelrc
{
  "plugins": [
    ["transform-react-jsx", {
      "pragma": "React.createElement",
      "useBuiltIns": true
    }]
  ]
}

// src/app.js
import React from 'react';

function App() {
  return (
    <div className="container">
      <h1>Hello, Babel 6 JSX!</h1>
      <p>This is an example of JSX transformed by `babel-plugin-transform-react-jsx`.</p>
    </div>
  );
}

export default App;

view raw JSON →