Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add build script for main npm package with named module export #78

Open
christopher-johnson opened this issue Dec 10, 2018 · 2 comments

Comments

@christopher-johnson
Copy link
Contributor

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 the App 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.

export { App } from './components/App';
@mejackreed
Copy link
Collaborator

Is it possible here to handle both scenarios? I think we need to support:

  • An adopter who is using the Mirador npm package and instantiating in a custom way
  • An adopter who is just requiring the mirador.js package and instantiating in the basic way Mirador({id: 'foo'})

@christopher-johnson
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants