webpack配置es6高级语法

##安装配置项(通过yarn)

yarn add babel-core [email protected] babel-plugin-transform-runtime babel-preset-env babel-preset-stage-0 --dev

##在webpack.config.js中增加一个规则项

module:{
rules:[
{test:/\.js$/,use:'babel-loader',exclude:/node_modules/},
]
}
##在项目根目录中创建一个.babelrc的文件,写入
{
"presets":["env","stage-0"],
"plugins": ["transform-runtime"]
}
 

转载于:https://www.cnblogs.com/Ericfirst/p/11356264.html

你可能感兴趣的:(webpack配置es6高级语法)