umd
— Universal
Module Definition for use in automated build systems
umd
(Universal Module Definition) is a
common pattern used in javascript programming allowing one to write once a
loader working in different context (server, browser). This loader is
compatible with different API like RequireJS, AMD or CommonJs. This command
provides simple synchronous wrapping of a string, return style module
support, CommonJS support and support preventing internal UMDs from
conflicting. Required parameter name is used for exporting module.
-c,
--commonJS
- Use CommonJS module format
umd -c my-module < my-module.js > my-module.umd
cat my-module.js | umd my-module | uglifyjs > my-module.umd.min.js