babel-plugin-transform-jsx-fragment
v0.1.5
Published
Downloads
2,575
Readme
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",
"ignoreModuleCheck": false,
}]
]
}
- moduleName: String, Optional, import module name, default to 'rax'.
- ignoreModuleCheck: Boolean, Optional, ignore checking the imported
Fragment
from samemoduleName
, default tofalse
.
Via CLI
$ babel --plugins transform-jsx-fragment script.js
Via Node API
require("babel-core").transform("code", {
plugins: ["transform-jsx-fragment"]
});