-
Notifications
You must be signed in to change notification settings - Fork 37
Description
VUX version
2.9.2
OS/Browsers version
Chrome
Vue version
2.5.17
Code
这是我的 .babelrc 文件的配置
{
"presets": [
[
"@babel/env",
{
"useBuiltIns": "usage",
"modules": false,
"targets": {
"browsers": [
"android >= 4",
"safari >= 5",
"ios_saf >= 4",
"> 1%",
"last 4 versions",
"not ie <= 8"
]
}
}
]
],
"plugins": [
"transform-vue-jsx",
"transform-es2015-parameters",
"@babel/plugin-transform-parameters",
"@babel/plugin-transform-runtime",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-json-strings",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"@babel/plugin-proposal-function-sent",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions"
],
"env": {
"test": {
"presets": [
"@babel/preset-env"
],
"plugins": [
"transform-vue-jsx",
"istanbul",
"@babel/plugin-transform-parameters",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-json-strings",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"@babel/plugin-proposal-function-sent",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions"
]
}
}
}
Steps to reproduce
@babel/core 版本是 7.0.0
vux-loader 版本是 1.2.9
webpack 版本是 3.6.0
在 babel 编译之后,在src\plugins\alert\index.js 文件内 第12行 show (options = {}) { 就不能被 转译了。于是,在手机上,就会报一个错误“Unexpected token =”。
但是,非常奇怪的是,在我自己里 业务代码内的【 ES6 函数默认参数】 就能够被 正确地 转译。
能不能给一些 问题可能 出在哪里的提示呀?
What is Expected?
在src\plugins\alert\index.js 文件内 第12行 show (options = {}) { 就能被 转译。
What is actually happening?
在 babel 编译之后,在src\plugins\alert\index.js 文件内 第12行 show (options = {}) { 就不能被 转译了。于是,在手机上,就会报一个错误“Unexpected token =”。