parent
23903e7ef4
commit
a1cdbdafcf
4 changed files with 10 additions and 12 deletions
13
Readme.md
13
Readme.md
|
@ -119,22 +119,21 @@ app.use(convert(function *(next) {
|
||||||
```
|
```
|
||||||
|
|
||||||
## Babel setup
|
## Babel setup
|
||||||
For Node 4.0 and Babel 6.0 you can setup like this
|
|
||||||
|
For Node 4.0 and Babel 6.0 you can setup like this:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
// install babel and required presets
|
$ npm install babel-register transform-async-to-generator --save
|
||||||
$ npm install babel-core --save
|
|
||||||
$ npm install babel-preset-es2015-node5 --save
|
|
||||||
$ npm install babel-preset-stage-3 --save
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// set babel in entry file
|
// set babel in entry file
|
||||||
require('babel-core/register')({
|
require('babel-register')({
|
||||||
presets: ['es2015-node5', 'stage-3']
|
plugins: ['transform-async-to-generator']
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Check out an example in koa's [test](test/babel/index.js).
|
||||||
|
|
||||||
## Running tests
|
## Running tests
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,9 @@
|
||||||
"tag": "next"
|
"tag": "next"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-core": "^6.1.2",
|
|
||||||
"babel-eslint": "^6.0.0",
|
"babel-eslint": "^6.0.0",
|
||||||
"babel-plugin-transform-async-to-generator": "^6.0.14",
|
"babel-plugin-transform-async-to-generator": "^6.0.14",
|
||||||
|
"babel-register": "^6.9.0",
|
||||||
"eslint": "^2.5.3",
|
"eslint": "^2.5.3",
|
||||||
"eslint-config-standard": "^5.1.0",
|
"eslint-config-standard": "^5.1.0",
|
||||||
"eslint-plugin-babel": "^3.1.0",
|
"eslint-plugin-babel": "^3.1.0",
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"plugins": ["transform-async-to-generator"]
|
|
||||||
}
|
|
|
@ -2,5 +2,7 @@
|
||||||
|
|
||||||
// http://babeljs.io/docs/setup/#babel_register
|
// http://babeljs.io/docs/setup/#babel_register
|
||||||
|
|
||||||
require('babel-core/register');
|
require('babel-register')({
|
||||||
|
plugins: ['transform-async-to-generator']
|
||||||
|
});
|
||||||
require('./_test.js');
|
require('./_test.js');
|
||||||
|
|
Loading…
Reference in a new issue