Ad

Transform JSX Only

Support of ES6 is improving (https://kangax.github.io/compat-table/es6/) and upcoming version of Chrome seems to support more than what Babel can.

How would it be possible to change the toolchain to only transform JSX. Right now Babel must transform everything to ES5.

I can't find a way to transform the JSX portion to ES5 or ES6 and leave the ES6 code the way it is.

Do you know any way to use babel to only transform the JSX.

Our current app is designed to work only on Chrome so backward compatibility is not an issue (It's an in-house project).

Ad

Answer

If you use Babel 6, you can do this with the following .babelrc:

{
    "plugins": ["transform-react-jsx"]
}

This will tell Babel to only transform jsx, and nothing else.

Ad
source: stackoverflow.com
Ad