GitHub pages and es6

GitHub pages and es6
0

#1

Hey there,
does anyone know if GitHub pages uses a built-in compiler for es6 (and beyond)? If not, do you know how to install one like babel? I couldn’t find anything about it.


#2

You install babel on your own computer and use it to process your ES6 file, transpiling it to ES5.

All you need to upload to gh-pages is the file that babel spits out.

GitHub itself doesn’t do any transpiling - it’s just a static file host, with no processing capability.


#3

How can I get this file?


#4

Well, it depends.

Personally, I use webpack to bundle all my various parts of my React apps.

Babel is one of my dependencies, and I have babel presets for ES6+

When I run the webpack command on my computer, a file called bundle.js gets built from all my ES6 files - it gets added to the same directory my index.html file is in. I needed to configure webpack to do those things though - it doesn’t just happen out of the box.

If you have not used babel yourself yet, I’d recommend getting it set up on your machine and reading their docs.

You’re entering NodeJS / npm territory at this point, so if you are not familiar with those yet, you’ll need to read up on those, too.

It’s a bit of a cliche in JavaScript development these days that to just get started with writing ES6 you have to learn a whole bunch of other technologies, install a tonne of new dependencies and copy/paste a load of boilerplate config files…but it’s just the way it is at the moment! It can be overwhelming, but if you take it piece by piece, it can be figured out.


#5

Ok thank you :slightly_smiling_face: