babel-preset-chengxin

1.0.0 • Public • Published

诚信认证产品使用的babel配置

面向诚信产品(IE6+)需求的babel配置,本配置只适合使用AMD标准的浏览器环境,请不要使用在node.js中。 可以使用.babelrc文件,或者直接引用本预设。

ES3

支持以下ES3插件:

  • transform-es3-member-expression-literals:解决ES3不支持foo.catch写法的问题
  • transform-es3-property-literals:解决ES3不支持{catch: ''}写法的问题

ES2015

支持以下ES2015插件:

  • check-es2015-constants:用于检测常量是否被更改
  • transform-es2015-arrow-functions:箭头函数 (a, b) => a + b,不使用强制this检查,以减少代码体积
  • transform-es2015-block-scoped-functions:块级作用域函数
  • transform-es2015-block-scoping:块级作用域变量
  • transform-es2015-classes:类定义,鉴于需要兼容ES3,所以只提供loose模式,并且不允许使用getter/setter
  • transform-es2015-computed-properties:使用计算后的属性,不使用loose模式,重载helper函数
  • transform-es2015-destructuring:解构,不使用loose模式,重载helper函数
  • transform-es2015-literals:支持二进制和八进制的字面量
  • transform-es2015-parameters:函数参数处理
  • transform-es2015-shorthand-properties:精简属性
  • transform-es2015-spread:函数和数组的spread
  • transform-es2015-template-literals:字符串模板

以下相关插件默认不支持:

  • transform-es2015-function-name:无实际应用
  • transform-es2015-for-of:包括loose模式都可能需要Symbol的支持,默认不支持,不提供shim。
  • transform-es2015-object-super:__proto__是个私有属性,IE678无法进行支持。
  • transform-es2015-sticky-regex:没有使用场景。
  • transform-es2015-unicode-regex:没有使用场景。
  • transform-es2015-typeof-symbol:默认不支持Symbol,需要支持请自行添加。
  • transform-regenerator:generator的使用代价过高,不支持。
  • transform-es2015-modules-amd:babel默认的AMD翻译,并没有把exports.default转写到module.exports上,并且没有处理es3-member-expression-literals。因此开发时暂时使用旧的AMD规范书写。

ES7

补充以下实用的ES7特性:

  • transform-class-properties:类支持属性定义
  • transform-object-rest-spread:对象spread

其它

  • transform-runtime:添加babel-runtime 支持
  • transform-modules-esl:适合浏览器的模块转换器

Readme

Keywords

none

Package Sidebar

Install

npm i babel-preset-chengxin

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • liuxuanzy