supporting both CommonJS and AMD

amd, commonjs, javascript

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"

Problem

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)

Original source