Join Eve Porcello for an in-depth discussion in this video Transpiling ES6 with Babel and babel-node, part of Up and Running with ECMAScript 6.
- In a real project, you're probably going to want…to use the real Babel.…To do this, we're going to install Babel with NPM.…Then we're going to use babel-node.…I first want to open my index.html file,…and we're going to make a few adjustments.…First, I'll get rid of the cdn link here on line four.…And then I'm going to take my nameBuilder function,…including its function call,…and I'm going to copy and paste this…into a new file called script.js.…
So we'll just go ahead and save this…as script.js,…and we'll clean it up a little bit too.…Okay, so now we need to install…a few things using NPM.…NPM is the package manager…that comes with Node.js.…If you don't have Node installed already,…you can go to the nodejs.org website…and follow the installation instructions.…Once we do that, we'll open up our terminal window.…Here we're going to type npm install…- g babel.…
So -g is going to install this globally.…Without the -g, we'll install this locally.…If you're using a PC, you can run your command line…as an administrator.…
- What is ECMAScript?
- Transpiling ECMAScript with Babel and Babel-node
- Using the let and const keywords
- Creating strings with template strings
- Enhancing object literals
- Working with ES6 classes and class inheritance
Skill Level Beginner
Q: The Babel API is out of date. How do I proceed with the course?
A: We are updating the course. In the meantime, you can install the babel-cli package and then install the presets that you need to follow along with the tutorials.