Konubinix' opinionated web of thoughts

Universal Module Definition


See What are CJS, AMD, UMD, and ESM in Javascript?

UMD module is a JavaScript file that tries to guess at runtime which module system it’s being used in, and then it acts as that kind of module. So you can load the file in a plain <script>, or you can load it from an AMD module loader, or you can load it as a Node.js module, and it will always do something sensible


Despite claiming to be “universal”, there’s one big module system that UMD doesn’t support: ECMAScript modules, i.e. The Future! You can’t write import {foo,bar} from ‘./someUmdModule.js’ and expect it to work.


Notes pointant ici