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

Inject.disableAMD

0.7.x

Inject.disableAMD();

When mixing script tags with Inject, you may come across a scenario where a well-intentioned module wants to test for AMD define before declaring an anonymous module.

if (module && module.exports) {
  // commonJS code...
}
else if (define && define.amd) {
  // AMD code...
}
else {
  // assign to window.*
}

If this file is included directly using a <script> tag, but after Inject has been placed on the page, you’ll likely get an error. RequireJS describes this error better than most.

If you absolutely unconditionally must mix script tags and Inject, we recommend disabiling the global “amd” parameter on the define object. This means that when objects are loaded via a script tag manually, they will not act like AMD modules.

To enable, include this line in your Inject configuration, after Inject has loaded, but before any script tags are added to the page.

Inject.disableAMD(true);

See: Inject.enableAMD()

comments powered by Disqus