AMD module dependencies

When working with modules, it is often the case that one module must be loaded before another. When module B needs to have module A loaded already, we can say that module B has a dependency on module A. When building a standard HTML page, this dependency is fairly easy to get right. All we need to do is ensure that the <script> tag for module A is included in the web page above the <script> tag for module B. Unfortunately, this is slightly more difficult when using AMD module loading.

With AMD module loading, each module is loaded independently and asynchronously. This means that the order by which we specify our modules is not enough. What we need in this case is to be able to describe the dependencies between modules, ...

Get Mastering TypeScript 3 - Third Edition 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.