npm i babel-core babel-loader babel-plugin-transform-runtime -D
npm i babel-preset-env babel-preset-stage-0 -D
webpack.config.js
{ test: /\.js$/, use: 'babel-loader', exclude: /node_modules/ } //配置babel转换ES6语法
添加文件.babelrc
{
"presets": ["env", "stage-0"],
"plugins": ["transform-runtime"]
}
可能会出现babel-loader和babel-core版本的问题,babel-loader 7要对应babel-core 6
直接安装会安装babel-loader 8,卸掉重装
image.png
网友评论