Lesson 8 with Babel
johnthad opened this issue · 1 comments
johnthad commented
If you prefer Babel to TypeScript, follow these steps:
- Install Babel:
npm install --save-dev babel-cli
- Install the presets required for async generators:
npm install --save-dev babel-preset-es2016 babel-preset-stage-3
- Enable the presets by created the following
.babelrc
:
{
"presets": ["es2016", "stage-3"]
}
- To package.json, add the script
"babel:8": "babel ./lesson-8/async.js --out-file ./lesson-8/compiled.js"
- Run the script:
npm run babel:8
- Create
./lesson-8/polyfill.js
:
require("babel-polyfill");
require('./compiled.js');
- Run the program:
node ./lesson-8/polyfill.js
:
$ node ./lesson-8/polyfill.js
1
2
3
mariusschulz commented
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.