$ npm install babel-plugin-transform-jsx-fragment
In
export default function Foo() {
return (<Fragment></Fragment>);
}
Out
import { Fragment } from "rax";
export default function Foo() {
return <Fragment></Fragment>;
}
$ npm install babel-plugin-transform-jsx-fragment
.babelrc
(Recommended).babelrc
{
"plugins": [
["transform-jsx-fragment", {
"moduleName": "preact",
"ignoreModuleCheck": false,
}]
]
}
Fragment
from same moduleName
, default to false
.$ babel --plugins transform-jsx-fragment script.js
require("babel-core").transform("code", {
plugins: ["transform-jsx-fragment"]
});
© 2010 - cnpmjs.org x YWFE | Home | YWFE