Universal Module Definition (UMD) packages a JavaScript component so it can load through CommonJS, AMD, or a browser global. This makes one bundle usable with systems such as RequireJS or with no loading mechanism at all. section 12.4
A UMD bundle supports three loading paths:
- CommonJS for applications using that module system. section 12.4
- AMD for asynchronous loaders such as RequireJS. section 12.4
- A browser global attached to window, such as window.slider. section 12.4
Building a UMD component
Rollup can convert src/slider.js into slider.js with `--format umd --name slider`. The generated global is window.slider; choose a distinctive name to reduce application conflicts. Source modules remain available for a larger application to import and bundle independently. section 12.4
./node_modules/.bin/rollup chapter12and13/components/slider/src/slider. js --file chapter12and13/components/slider/slider.js --format umd --name slider -m
Inspect the complete Rollup command for producing a named UMD bundle. section 12.4
