-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
怎么设置可以让 taro 转成小程序后的代码是 es6 风格的? #3602
Comments
欢迎提交 Issue~ 如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏 如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。 Good luck and happy coding~ |
Taro 代码的转译是 Babel 管理的,你可以看下能不能改 Babel 设置。 |
额,还有这种需求么,taro 目前没有配置关闭 babel 编译的选项 |
可能他在调试时遇到了些问题,因为缺少 sourceMap ,经常在打断点的时候要面对 Babel 过的 ES5 代码。 |
// node_modules/@tarojs/cli/src/weapp.js
// 我把 defaultBabelConfig 注释掉后自己的babel conf (包括targets等,见下) 才生效
const babelConfig = _.mergeWith({}, defaultBabelConfig, pluginsConfig.babel, (objValue, srcValue) => { // config/index.js
const config = {
sourceMap: true,
presets: [
['env', {
modules: false,
spec: true,
// debug: true,
targets: {
node: 6,
chrome: 57,
},
}]
], 另外taro用的uglify也不支持es6, 换掉这个之前可能没法es6 ready |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
现在编译之后的代码是 es5 的,看着难受
The text was updated successfully, but these errors were encountered: