RFC: Publishing to NPM as ES5
Is this something we want to do? I've been looking at it because pubsweet-components#37 needs a build config and pubsweet-components#39 will be affected by it. But I've got myself a bit stuck and would like some input.
Building with webpack
- Need to build each package individually so that the files go to the right place.
- Webpack config gets complex as need to mark most modules as
externals
to avoid bundling stuff likereact
in the component.
Using Babel instead
- This is dead simple for JS/JSX
- Doesn't help with CSS etc.
PostCSS
-
postcss-modules
can precompile the CSS to have the CSS modules class names and spit out a JSON file mapping old class names to class names with hashes. - It can also put it through
node-sass
first. - Consumers need to load stylesheets and fonts for each component separately from the component itself :(
- Because of the dynamic class names in CSS modules, we can't get consumers to provide their own styles (or load our source style sheets) unless we also accept props for all the class names.
Theming
- Maybe none of this matters if we use something like
react-css-themr