Search code examples
javascriptamdcommonjs

supporting both CommonJS and AMD


Is there a way to create a javascript micro-library (a library that has no dependencies), that support all of the following module formats:

  • Asynchronous Module Definition
  • CommonJS
  • exposing the library's exports as a global namespace object (no loader)

Solution

  • Here is a list of various cross-compatible module formats.

    I suspect that the one you're looking for is what they're calling "commonjsStrict.js"