Dependency Management Got Awesome CommonJS and AMD Compliant dependency loader for modern web apps

Inject.addPackage

0.6.x

OLD: This is an old version of documentation. You probably want the most recent version of this document, from the sidebar on the right.
Inject.addPackage(resolvedId, alsoKnownAs);

Sometimes you want a Module ID to be available in more than one location. While Inject can change a module’s ID directly using Inject.addModuleRule, this can sometimes throw off relative includes. Instead, it’s much easier to map a resolvedId to multiple locations.

These “virtual” locations behave just like a normal exports location and can be require()-ed as well.

Examples

// install jQuery into a global location
Inject.addPackage('common/libs/jquery', 'jquery');

resolvedId

This is the resolved Module ID to compare against. It is a string.

alsoKnownAs

This is the additional Module ID to save this package under. It is a string.

The family of rules Inject supports:

comments powered by Disqus