Universal Module Definition
Fleeting- Référence externe : https://jameshfisher.com/2020/10/04/what-are-umd-modules/
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
- webpack bundled JS library with “umd” module system in Nodejs throws error: “self” is not defined
- What are CJS, AMD, UMD, and ESM in Javascript?