1.安裝包 es6語法解析,react與jsx解析的相關包node
npm install babel-core babel-preset-env babel-preset-react --save-devreact
2.安裝reactwebpack
npm install react --save-deves6
3.webpack.config.js文件web
{ //轉換es6語法 test:/(\.jsx|\.js)$/, use:{ loader:"babel-loader", }, exclude:/node_modules/ //排除轉換目錄 }
4.根目錄新建.babelrc文件npm
{ "presets":["env","react"] }