This project uses Babel to transpile both back-end and front-end JavaScript on-the-fly, and SystemJS to load transpiled modules in the browser. See HyperDev or demo.
Change presets and other Babel options by updating the "babel" section of package.json
- HyperDev runs the
start
command which passesserver.js
through Babel (obeying options in package.json) and then runs the resulting JavaScript. - The
server.js
defines an Express server and middleware function which passes all requests ending in ".js" through Babel'stransformFile
. - User requests the index in their browser.
- Back-end serves index.html.
- Browser loads SystemJS.
- Browser requests app.js.
- Back-end transpiles app.js using same options from step 1, but with SystemJS module definitions.
- Browser evaluates ES5 code generated by previous step.