Chetan Motamarri
Chetan Motamarri

Reputation: 1244

Babel not transpiling from JSX to JS, tried manually without using webpack/browserify/bower

I am trying basic example in React.JS and using Babel to transpile from jsx to js. I hope I installed all babel dependencies, shown in package.json below. Also added App.jsx and index.html pages.

As shown in line 8 of package.json, I am trying to execute babel with "npm run build" but it is throwing error as shown in this terminal screenshot.

Any help appreciated.

enter image description here

enter image description here

enter image description here enter image description here

Upvotes: 1

Views: 1091

Answers (1)

robertklep
robertklep

Reputation: 203534

This happens when you don't configure Babel (properly).

Add this to your package.json:

"babel" : {
  "presets": ["es2015", "react" ]
}

More information here.

Upvotes: 3

Related Questions