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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.