-
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
【小程序】在新版微信开发者工具下是否可以让开发者定制babel preset: {env}的使用与否 #4086
Comments
欢迎提交 Issue~ 如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏 如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。 Good luck and happy coding~ |
Taro 的 babel 配置是用户可以自己配制的,另外使用 Taro 的话,不建议再开启小程序开发者工具的 es 编译,通过配置相关 babel 插件,可以达到相应目的 |
因为我们的taro是用的babel6来做的,我们的helpers会打进每个文件。如果我们引用transform-runtime,来做的话,又会把不需要的core-js引进进来。 |
Taro 3 已升级 babel 7,也可以配置是否使用 preset env。 |
现在最新版小程序微信开发者工具1.02.1907160, 支持增强编译功能
https://developers.weixin.qq.com/community/develop/doc/000c8abaa7c6b074f4e87321756401
使用preset-env,支持最新的ECMAScript语法
共享helpers函数,默认放在项目@babel/runtime目录,可通过项目配置文件配置
支持async/await语法,按需注入regeneratorRuntime,目录位置与helpers函数一致
文件首行是// use strict disable;时,即可禁用文件严格模式
可通过项目配置文件指定任意文件、目录不经过编译(如:miniprogram_npm)
原有逻辑是支持stage0语法的,为了向前兼容,引入了一系列proposal插件
关于polyfill,基础库中已经引入了大量的es6相关的polyfill 可参考文档,增强编译下,新增:Array.prototype.includes(es7)、Object.entries(es8)、Object.values(es8)
我们的在走编译的时候会强行走presets: 'env', 导致无法用到上述增强编译带来的便利性
期望行为
babel preset env是否开启
The text was updated successfully, but these errors were encountered: