简体   繁体   中英

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.

在此输入图像描述

在此输入图像描述

在此输入图像描述 在此输入图像描述

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

Add this to your package.json :

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

More information here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM