除常见的添加es6-promise.js和babel-polyfill配置外还需以下配置
根目录中创建.babelrc文件
文件中添加代码
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}}]
],
"plugins": ["syntax-dynamic-import", "transform-vue-jsx", "transform-runtime", "transform-object-rest-spread"],
"comments": false,
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
},
"development": {
"plugins": ["dynamic-import-node"]
},
"production": {
"plugins": ["transform-remove-console"]
}
}
}
网友评论