Skip to content Skip to sidebar Skip to footer

Use Babel To Transform Jsx Only

I am using Babel with React js. Problem is I don't want to convert es6 to es5. I want to keep using es6. I only need to transform jsx to js. This is my .babelrc { 'plugins': ['tr

Solution 1:

You're using class properties syntax e.g. someVar = () => {}

Which will not be transformed by the jsx plugin. You'll need to add plugins for all of those advanced features which are still proposals.

Here's the babel plugin for class properties: https://babeljs.io/docs/plugins/transform-class-properties/

Essentially, it'll only transform the plugins you give it, but class properties aren't supported in browsers yet, let alone in node.


Solution 2:

It depends on the Browser you are using if that browser doesn't support all the es6 feature or some, then those errors are apprehensive


Post a Comment for "Use Babel To Transform Jsx Only"