chenjun1011 / babel-plugin-transform-jsx-fragment

Fragment support for jsx plus.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

babel-plugin-transform-jsx-fragment

Example

In

export default function Foo() {
  return (<Fragment></Fragment>);
}

Out

import { Fragment } from "rax";

export default function Foo() {
  return <Fragment></Fragment>;
}

Installation

$ npm install babel-plugin-transform-jsx-fragment

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": [
    ["transform-jsx-fragment", {
      "moduleName": "preact"
    }]
  ]
}
  • moduleName: Optional, import module name, default to 'rax'.

Via CLI

$ babel --plugins transform-jsx-fragment script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-jsx-fragment"]
});

About

Fragment support for jsx plus.


Languages

Language:JavaScript 100.0%