package.json中需要引入以下依赖:
开发依赖:
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.4”,
运行时依赖:
"react": "^16.6.0",
"react-dom": "^16.6.0"
webpack.config.js中需要增加以下模块解析处理规则:
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
更详细的安装与配置方法请参考以下链接:
https://github.com/babel/babe...
https://babeljs.io/docs/en/ne...
https://www.npmjs.com/package...
https://www.npmjs.com/package...
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。