mariusschulz/egghead-async-await

Lesson 8 with Babel

johnthad opened this issue · 1 comments

If you prefer Babel to TypeScript, follow these steps:

  1. Install Babel: npm install --save-dev babel-cli
  2. Install the presets required for async generators: npm install --save-dev babel-preset-es2016 babel-preset-stage-3
  3. Enable the presets by created the following .babelrc:
{
  "presets": ["es2016", "stage-3"]
}
  1. To package.json, add the script "babel:8": "babel ./lesson-8/async.js --out-file ./lesson-8/compiled.js"
  2. Run the script: npm run babel:8
  3. Create ./lesson-8/polyfill.js:
require("babel-polyfill");
require('./compiled.js');
  1. Run the program: node ./lesson-8/polyfill.js:
$ node ./lesson-8/polyfill.js 
1
2
3

Thanks for sharing your Babel setup, Thad! I'm sure this will be helpful to others.

I'm closing this issue so it doesn't show up as open. Let me know if you want me to re-open it.