You can take a look at the exact definition of transpilers in general on Wikipedia here.
Types Of Transpilers
1 ) Run Time Transpilers:
As the name suggests this type of transpilers transpiles your code at run time. Keep in mind that if you have a lot of code then this will impact the performance of you code and will make it slow.
2 ) Compile Time Transpilers:
These type of transpilers will transpile your code into a separate file before running it. This will have improved performance and is recommended for big projects.
If we take a look at the compatibility chart here , under the section of Compilers/polyfills we see that Babel is the one that supports most of the ES6 features. And that is what we will be using.
We will be using babel-standalone i.e, we will include a babel file in our html document and that will make run time changes and make our ES6 code work.
Now it’s time to use babel we will do that by creating a simple html document we will name it as index.html and put the following code in it
<title>ES6 For Beginners</title>
This is the page Body
Notice that we are linking to the babel-standalone file on line 4 after which we have written some ES6 code in
script tag on line 6-11, the ES6 code used default parameters but we are not concerned with the code as we are learning how to get babel to work and we have achieved that. For the babel code to work we will need to use the
type="text/babel" attribute value in place of
Got A Question?