airyland / airyland/vux-loader

Babel 7 Webpack 3 vux 编译后【ES 6 函数 参数 默认值】就不能转译了。

未关闭
#72 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
64
派生
37
PR 合并指标
30 天内没有已合并 PR

描述

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 =”。

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。