Book Image

JavaScript at Scale

By : Adam Boduch
Book Image

JavaScript at Scale

By: Adam Boduch

Overview of this book

Table of Contents (17 chapters)
JavaScript at Scale
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Loading components


In this section, we'll take a look at the mechanisms responsible for actually loading our source modules and built components into the browser. There are many third-party tools in use today for structuring our modules and declaring their dependencies, but the trend is moving toward using newer browser standards for these tasks. We'll also look at lazily loading our modules, and the usability implications for load latency.

Loading modules

Many large-scale applications in production today use technologies such as RequireJS and Browserify. RequireJS is a pure JavaScript module loader and has tools that can build larger components. The aim with Browserify is to build components that run in the browser, using code that was written for Node.js. While both these technologies solve many of the issues discussed so far in this chapter, the new ECMAScript 6 module approach is the way forward.

The main argument in favor of using the browser-based approach to module loading and dependency...