From the course: Learn JavaScript: Write Modern Code with JavaScript ESNext
Unlock this course with a free trial
Join today to access over 25,000 courses taught by industry experts.
Use Babel to transpile code - JavaScript Tutorial
From the course: Learn JavaScript: Write Modern Code with JavaScript ESNext
Use Babel to transpile code
- So at this point we have our node script all written out, but there's still one thing we have left to do before we can run it. You see, if we try and run our script now, which we should be able to do by typing node source slash index.JS with two command line arguments and hitting enter, we see that we get an error. And the reason we get this error is because we wrote all our code using ES six syntax, which no JS currently does not support out of the box. So in order to actually run our code, we're going to use a tool called Babble, which takes the code that we wrote in ES six syntax, and trans compiles it to a syntax that no JS can actually execute. So in order to do that, we have to actually install a few Babble packages into our project. And the way that we do this, and in fact, the way that we install all NPM packages into our project, is by saying NPM install, and then the name of the packages that we want to install. Now in our case, there's three main packages we're going to…
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Learning objectives1m 55s
-
(Locked)
Learn about writing and running JavaScript programs1m 44s
-
(Locked)
Write a JavaScript program for the browser12m 4s
-
(Locked)
Move JavaScript to an external script1m 20s
-
(Locked)
Install Node.js and NPM1m 58s
-
(Locked)
Write a Node script5m 57s
-
(Locked)
Use Babel to transpile code3m 2s
-
(Locked)
-
-
-
-
-