Source in several modules in ES6 and JSX. Two different approaches seem to be to either (1) bundle whole library into a single file or to (2) provide all modules, just transpiled by babel into old JS.
The second approach probably requires a client to use some kind of module bundler (?). On the other hand, it allows for better imports (without the need of exporting everything in index) and provides better error messages.
We have taken the first approach and there were several unclear points:
should (all) third party dependencies by excluded from the bundle (externals settings in webpack)?
how to create a library api (interace)? (currently, if often happens that some functionality is implemented, but the client can't use it, because it's not exported)
how to specify dependencies/peerDependencies/devDependencies? (e.g. should React be written in both peerDependencies and devDependencies? To me, it would make most sense to put it into dependencies, but it causes error on the client beacuse of two React instances... So how to decide which dependencies to put where?)
also, it was really unclear how to handle images (or static assets in general), and the current solution isn't very flexible (it forces client to provide static on a specific url)
how to easily verify library functionality for client and also convenient library development (currently, the solution is using examples which tries to mimic the client usage, but it's not the same situation. How should the examples and their config look like?)
Source in several modules in ES6 and JSX. Two different approaches seem to be to either (1) bundle whole library into a single file or to (2) provide all modules, just transpiled by babel into old JS.
The second approach probably requires a client to use some kind of module bundler (?). On the other hand, it allows for better imports (without the need of exporting everything in index) and provides better error messages.
We have taken the first approach and there were several unclear points: