babel-preset-alibaba
A babel preset for transforming your JavaScript for Alibaba.ir.
Currently contains transforms for all standard syntax that is stage 4 (ES2017) or stage 3, except for the following:
- generators:
regenerator-runtime
is too heavyweight for our use. - Compile the new function bind operator
::
to ES5. - Turn JSX into React function calls.
- Compile class and object decorators to ES5.
- Syntax Dynamic Import. Allow parsing of
import()
. source - Babel React Optimize in Production Mode:
- transform-react-constant-elements
- transform-react-inline-elements
- transform-react-remove-prop-types
- transform-react-pure-class-to-function
async/await
:regenerator-runtime
is too heavyweight for our use, and async-to-promises is not yet complete enough to be safely used.SIMD
: this is a performance feature, so is pretty pointless to polyfill/transpile.- lifted template literal restrictions: we do not use tagged template literals, nor implement custom DSLs, otherwise we would enable this.
Install
$ npm install --save-dev babel-preset-alibaba
Usage
.babelrc
(Recommended)
Via .babelrc
Via CLI
$ babel script.js --presets alibaba
Via Node API
;
Targeting Environments
This module uses babel-preset-env to target specific environments.
Please refer to babel-preset-env#targets for a list of available options.
For a list of browsers please see browserlist.
You may override our default list of targets by providing your own targets
key.
The following transpiles only for Node v6.
If you wish, you can also inherit our default list of browsers and extend them using additionalTargets
.