vux-loader icon indicating copy to clipboard operation
vux-loader copied to clipboard

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

Open stuartZhang opened this issue 5 years ago • 5 comments

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

stuartZhang avatar Nov 22 '18 09:11 stuartZhang

请问你的问题解决了么,我也遇到了同样的问题

yaoshining avatar Jan 24 '19 08:01 yaoshining

解决了。

把.babelrc配置文件改成 babel.config.js文件就行了。

发送自 Windows 10 版邮件https://go.microsoft.com/fwlink/?LinkId=550986应用


发件人: Shining [email protected] 发送时间: Thursday, January 24, 2019 4:40:46 PM 收件人: airyland/vux-loader 抄送: Stuart Zhang; Author 主题: Re: [airyland/vux-loader] Babel 7 Webpack 3 vux 编译后【ES 6 函数 参数 默认值】就不能转译了。 (#72)

请问你的问题解决了么,我也遇到了同样的问题

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/airyland/vux-loader/issues/72#issuecomment-457112818, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ANSlNyiJu2Ft6V7IaQG6H8JE8Vi5RASsks5vGXGOgaJpZM4Yu9Ms.

stuartZhang avatar Jan 25 '19 01:01 stuartZhang

太感谢了,这问题困扰了我三天终于解决了,应该给你发个大红包

yaoshining avatar Jan 25 '19 02:01 yaoshining

你在天津 吗?如果在天津的话,有兴趣年后 换换环境吗?我们【北京德惠众合信息技术有限公司】(http://company.zhaopin.com/CZ610916520.htm)的前端团队,急需 愿意对 前端技术栈 做【精耕细作】的优秀开发者。前端招聘难呀!好苗子都搞JAVA WEB与 大数据 去了。前端门庭冷落。

如果条件允许,希望你考虑考虑。

发送自 Windows 10 版邮件https://go.microsoft.com/fwlink/?LinkId=550986应用


发件人: Shining [email protected] 发送时间: Friday, January 25, 2019 10:44:13 AM 收件人: airyland/vux-loader 抄送: Stuart Zhang; Author 主题: Re: [airyland/vux-loader] Babel 7 Webpack 3 vux 编译后【ES 6 函数 参数 默认值】就不能转译了。 (#72)

太感谢了,这问题困扰了我三天终于解决了,应该给你发个大红包

― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/airyland/vux-loader/issues/72#issuecomment-457435708, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ANSlN6LqzTykNH81jyWIFbb0odU9sAIxks5vGm99gaJpZM4Yu9Ms.

stuartZhang avatar Jan 25 '19 04:01 stuartZhang

我们单聊吧,qq号发你邮箱了

yaoshining avatar Jan 25 '19 04:01 yaoshining