I've found the(?) github repository for UMD and it comes with this description (emphasis mine):
UMD (Universal Module Definition) patterns for JavaScript modules that work everywhere.
...
This repository formalizes the design and implementation of the Universal Module Definition (UMD) API for JavaScript modules. These are modules which are capable of working everywhere, be it in the client, on the server or elsewhere.
So far, this is straightforward. At least I think it is. Node.JS uses CommonJS by default. The browser uses globals by default. I think it's saying UMD works regardless of your module system; you can build your project once instead of once per module system.
But everything that follows confuses me:
The UMD pattern typically attempts to offer compatibility with the most popular script loaders of the day (e.g RequireJS amongst others)...
Doesn't this contradict the previous paragraph? Does UMD work everywhere or just in the most popular environments?
It goes on to list at least nine "variations" to choose from. Why would there be any variations if this is meant to be universal? How do I determine which one is right for my situation?
The readme is written as though I already know the answers to these questions, but I'm trying to learn what UMD is for and when to use it.
Note: This similar question is asking about other module systems, but not UMD.
As for why the variations: that’s described in the same README beside each variation.
You mean like, "amdWeb.js - Defines a module that works with AMD and browser globals?" I read that as a "what" the variation does and maybe "when" to use it. But I still don't know "why" it exists (I wrote my best guess between the two quotes). "Why" isn't there a single variation that works for everything? What part of this is Universal? – Billfish