1、安装支持库
安装 webpack,babel-core,babel-loader,babel-preset-react,babel-preset-env 这些基本库
安装方法

npm install webpack babel-core babel-loader babel-preset-react babel-preset-env --save-dev

2、配置webpack.config.js
增加以下babel-loader配置

module: {
        rules: [
            {
                test: /\.(jsx|js)?$/,
                exclude: /node_modules/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: ['env', 'react']
                    }
                }
            }
        ]
    }


3,如果在项目中存在jsx的组件引用,可能会出现模块找不到的情况(Module not found)
请在webpack.config.js中添加resolve

    resolve: {
        extensions: ['.js', '.jsx']
    }