6/6/2017 - 11:13 AM

You have three options:

  • Use <script> tag.
  • Use a CommonJS implementation. Synchronous dependencies like Node.js
  • Use an AMD implementation.

CommonJS client side-implementations include:

(most of them require a build step before you deploy)

  • Browserify - You can use most Node.js modules in the browser. This is my personal favorite.
  • Component - Focuses on simplicity. Browser only. Made by the same guy who made Express.js, the (most) popular Node.js web framework.
  • Webpack - Does everything (bundles JS, CSS, etc). Made popular by the surge of React.js. Notorious for its difficult learning curve.
  • Rollup - New contender. Leverages ES6 modules. Includes tree-shaking abilities (removes unused code). You can read more about my comparison of Browserify vs Component.

AMD implementations include:

  • RequireJS - Very popular amongst client-side JavaScript developers. Not my taste because of its asynchronous nature.

Note, in your search for choosing which one to go with, you'll read about Bower. Bower is only for package dependencies and is unopinionated on module definitions like CommonJS and AMD.

Hope this helps some.