readium / readium-shared-js

Repository for the shared JavaScript libraries that are used in the SDK-Launchers and other applications developed on top of the SDK
BSD 3-Clause "New" or "Revised" License
78 stars 102 forks source link

Build output: UMD bundle #439

Closed jccr closed 6 years ago

jccr commented 6 years ago

We need a library bundle output that's wrapped in UMD Unlike other bundle outputs this one should not depend on or include a built-in RequireJS loader such as almond.js. This increases the library's portability and allows it to be easily imported by various module and bundler systems. One such example is with Webpack/Browserify importing the library as CommonJS. This was not available out of the box with other build outputs.

Proposed solution:

This issue is an Enhancement

danielweck commented 6 years ago

UMD supports CommonJS (in addition to AMD, window global, etc.), therefore published libs such as CFI (readium-cfi-js) could potentially be distributed with the appropriate main field in package.json. What about jsnext:main / module to discover native ECMAScript modules? Is this on your radar? (just asking out of curiosity)

jccr commented 6 years ago

@danielweck Yes, possibly as another bundle type.

danielweck commented 6 years ago

Is this now fixed, Juan?

danielweck commented 6 years ago

Fixed via https://github.com/readium/readium-shared-js/pull/441 (correct me if I am wrong, Juan)