babel-preset-kylin
v6.22.8
Published
Babel preset for all es2015 plugins.
Downloads
2
Readme
kylin-babel-preset-es2015-nebula
该项目fork自 babel-preset-es2015
差异
- 默认不启用 "babel-plugin-transform-es2015-typeof-symbol", 需要通过参数
enableTypeofSymbol
- 默认不启用 "babel-plugin-transform-es2015-for-of", 需要通过参数
enableForOfArray
- 默认不启用 "babel-plugin-transform-regenerator", 需要通过参数
enableGenerator
- 自动引入 "kylin-babel-plugin-transform-runtime-nebula", 针对nebula容器进行特定es6转换
Install
npm install --save-dev kylin-babel-preset-es2015-nebula
Usage
Via .babelrc
(Recommended)
.babelrc
{
"presets": ["kylin-babel-preset-es2015-nebula"]
}
Via Node API
require("babel-core").transform("code", {
presets: ["kylin-babel-preset-es2015-nebula"]
});
Options
loose
- Enable "loose" transformations for any plugins in this preset that allow them (Disabled by default).modules
- Enable transformation of ES6 module syntax to another module type (Enabled by default to"commonjs"
).- Can be
false
to not transform modules, or one of["amd", "umd", "systemjs", "commonjs"]
- Can be
spec
- Enable "spec" transformations for any plugins in this preset that allow them (Disabled by default)enableTypeofSymbol
- 开启则引入babel-plugin-transform-es2015-typeof-symbol
, 默认不开启enableForOfArray
- 开启则引入babel-plugin-transform-es2015-for-of
, 默认不开启,遇到for-of
语法会直接抛错enableGenerator
- 开启则引入babel-plugin-transform-regenerator
, 并且配置runtime-nebula
支持, 默认不开启nebulaTarget
- 默认common,可选["common","ios8","u4"],指定兼容到的nebula
容器版本requeue
- 废弃选项
{
presets: [
// by default
["babel-preset-kylin", {
"loose": false,
"modules": "commonjs",
"spec": false,
"enableTypeofSymbol": false,
"enableForOfArray": false,
"enableGenerator": false,
"nebulaTarget": "common"
}]
]
}