Using Browserify for Packaging Modules
One thing that ES5 does not have is a built-in module system. When you built CoffeeRun, you used a workaround that let you write modular code – but depended on modifying a global variable.
ES6 provides true modules, like those in many other programming languages. Babel understands ES6 module syntax, but there is no equivalent ES5 code for it to convert to. That is why Browserify is necessary.
Figure 17.10 shows how Browserify and Babel will work together.
Figure 17.10 Converting from ES6 modules to ES5 modules with Babel and Browserify
By default, Babel converts ES6 module syntax into ...
Get Front-End Web Development: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.