Open christopher-johnson opened 5 years ago
Is it possible here to handle both scenarios? I think we need to support:
Mirador({id: 'foo'})
sure you can do both, but not in the same package. I would prioritize ES6 above CJS require
package support, since this is how want to use it. But there may those who prefer CJS. The way that I see it, ES6 is the future, so for a new app, I think it should be the target idiom. Anyway, if someone wants to use CJS, they can use the distribution, so npm is actually not required for them. npm is however required for those who want to import an ES6 module.
an importable npm package is typically referenced with package.json that contains a
main
property. e.g."main": "lib/index.js"
. To build this index.js file requires a distinct build script than the current distribution build. The entry point index only exports theApp
module and not the DOM element binding or the redux Provider or store, as these would be implemented by the downstream consumer.For example, the entry point
index-lib.js
only contains.