Lesson 3. Bundling modules with Browserify

 

Modules are a big part of the additions to JavaScript. As you’ll learn in this lesson, transpiling alone is not enough for modules. This is because the most defining aspect of modules is that they break your code into seperate files. This means that you’ll need to bundle them into one file. There are several popular tools for bundling JavaScript modules; two popular up-and-coming options are Webpack and Rollup. In this lesson you’ll use one of the first ones that hit the scene, Browserify.

3.1. What’s a module?

Many programming languages support modularized code. Ruby calls these pieces of modularized code gems, Python calls them eggs, and Java calls them packages. JavaScript never had official support for this concept until ES2015 with the introduction of modules. A module is an individual file of modularized JavaScript code. Becuase JavaScript was so late to this party, many community solutions for modules in JavaScript were created, the most ubiquitous being node.js modules.

3.2. How modules work in Node.js

Node.js has a fantastic module system with NPM. NPM is the Node package manager that comes bundled with Node.js. With roughly a quarter of a million packages published to NPM’s registry and billions of downloads a month, NPM is one of the richest ecosystems of code in the world.

3.3. What is Browserify?

3.4. How does Browserify help with ES6 modules?

3.5. Setting up Browserify with Babel

3.6. Alternatives to Browserify

Summary

sitemap