How to Install and Use Babel to Transpile JavaScript

How to Install and Use Babel to Transpile JavaScript

SelfTaughtDev

5 лет назад

16,073 Просмотров

Want To Become A Developer? Checkout The Courses Here And Get Started - https://courses.selftaught-dev.com/

**If the video quality makes the text illegible; Increase your view quality to 1080p.**

Short tutorial on how to install babel and use it to transpile JavaScript from ES6 to ES5.

-------Commands Used ----------

1. "npm install -g babel-cli"
2. "npm install babel-preset-env -save-dev"

*This will install babel and the preset we need to transpile. But you'll also need to create the ".babelrc" file. It is literally a file names .babelrc with the following text inside:

"{
"presets" : ["env"],
"plugins : [ ]
}"

To actually transpile your JS file we'll do:

1. "babel (Name of file to transpile) --out-file (Name of file you would like output)"

For the video we used:

"babel test.js --out-save test1.js"

------------------------------------------

Join Discord 👊 https://selftaught-dev.com/join-discord/

Get My Resume Template Free - https://selftaught-dev.com/resume-template/

Practice Projects - https://selftaught-dev.com/

Send me your resume to review 📧 [email protected]

Support The Channel & Help Upgrade Equipment------
Patreon - https://www.patreon.com/selftaughtdev
Paypal - paypal.me/selftaughtdev

Contact Me----------
Portfolio - 📡 https://selftaught-dev.com/portfolio
FaceBook - https://www.facebook.com/ghughes2
Instgrams - https://www.instagram.com/ghughes13/
Linkedin - https://www.linkedin.com/in/garrett-hughes-5320626b/
Tweet - 🐤https://twitter.com/Ghughes139

Music--------
https://soundcloud.com/corporaterape
Do you make music and want to let me use it on the channel? Shoot me an email so we can talk!

Тэги:

#HTML #css #babel #javascript #how #to #transpile #es6 #es5 #Garrett_Hughes #Html #html5 #Javascript #Express #node.js #python #react #learn #become #web_developer #how_to #tutorial #follow #vlog #life #tech #Technology #Front #End #Selftaughtdev #Self #Taught #Dev #Garrett #Hughes #HTML5 #Code #Learn #Programmer #Front_end #Back_end #Computer_science #Software_developer #coding
Ссылки и html тэги не поддерживаются


Комментарии:

TechMobile
TechMobile - 30.08.2021 20:29

Hmmm

Ответить
Юрий Шкварц
Юрий Шкварц - 13.06.2021 12:10

Your computer is old? *(

Ответить
Adil a
Adil a - 18.04.2021 00:06

Thanks for uploading this video. I just started to use Atom and when I run my JavaScript, I am having a "'BABEL_PARSE_ERROR' note. Is this because I did not install babel?

Ответить
Dexter
Dexter - 20.01.2021 22:45

10-15mins to install....wow, what is the age of the computer? 2000 years old? Surely not even a 10 year old computer will take that long

Ответить
erb214_79
erb214_79 - 21.12.2020 10:50

im a big fan of pit of babel

Ответить
Samia Ghezal
Samia Ghezal - 11.08.2020 12:39

Thank you. Simple and straight to the point.

Ответить
Itty Bitty Bits
Itty Bitty Bits - 30.07.2020 21:22

I can't tell you how frustrated I was by the class I was taking online and by the babel site when I was trying to set this up. Nowhere did I look did it say I needed to install Node and let it install babel. The video was simple to follow, the sound and video quality were good and it was very straight forward. Don't stress over your computer being slow. You can always trim those parts out. Thank you so much for this video.

Ответить
Todd Grigsby
Todd Grigsby - 28.01.2020 02:42

I really appreciate this video. The latest major round of changes to my product involved async calls that are ES6 specific, and uglifyjs was choking on them. Babel was clearly the solution, but I didn't have time to go through all the tutorials. This was exactly the short term solution I needed. Thank you!

Ответить
Kevin Aartsen
Kevin Aartsen - 13.06.2019 17:18

his name paul or ashley?

Ответить
George Monsour
George Monsour - 27.02.2019 18:51

a little heads up, it may be that your computer is old as you said but your open browser tabs are kicking your processor while its down, good work on the auto-didact path

Ответить
Unique Channel
Unique Channel - 05.02.2019 14:40

good. please tell me is the cnfig file '.babelrc' or '.babelrc.json' ?

Ответить
Prince Chowdhury
Prince Chowdhury - 10.11.2018 09:27

I am impressed by your video, Keep it up

Ответить
SelfTaughtDev
SelfTaughtDev - 29.09.2018 14:29

Did a course on node.js and using npm and realized I had no idea what the flags I was using did (eg. '--save-dev'). Probably going to remake this in a month or two.

Ответить
B.B.V. Productions
B.B.V. Productions - 23.09.2018 22:57

Thanks! I agree there is no video on how to install Babel yet.

Ответить