6.22.7 • Published 7 years ago
kylin-aaaaaa v6.22.7
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-nebulaUsage
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
falseto 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
["kylin-babel-preset-es2015-nebula", {
"loose": false,
"modules": "commonjs",
"spec": false,
"enableTypeofSymbol": false,
"enableForOfArray": false,
"enableGenerator": false,
"nebulaTarget": "common"
}]
]
}6.22.7
7 years ago