babel-preset-cosmo
Babel preset for Cosmo CLI
If you have bootstrapped your project with cosmo
, you are already using this preset. If you would like to configure it, Add .babelrc
to your project root. Cosmo
will use that as babel config instead of default preset.
To use it in a non-cosmo project, Follow the steps bellow:
Install
$ npm install @babel/core @babel/cli babel-preset-cosmo $ npm install @babel/runtime --save
Or using yarn
:
$ yarn add --dev @babel/core @babel/cli babel-preset-cosmo $ yarn add @babel/runtime
Usage
In your .babelrc
:
ESNext supported features:
-
All the features supported by
babel-preset-env
-
Support for
flow
types:
const add = x: number y: number: x + y;
- Class properties
console;
- Async/Await
const sleep = ; const logAfterTenMs = async { await ; console;};
- Object rest-spread
// Rest propertieslet x y ...z = x: 1 y: 2 a: 3 b: 4 ;console; // 1console; // 2console; // { a: 3, b: 4 } // Spread propertieslet n = x y ...z ;console; // { x: 1, y: 2, a: 3, b: 4 }
License
MIT © Sid Doshi