Hi
I'm trying to use create-react-app to build a React library, but I'm facing some challenges. Maybe create-react-app is not the best-fit approach for this and "we" should create something like create-react-lib project.
Current challenges:
package.json/index entryMaybe this is not suitable for this project. In that case, please point me to relevant projects that address this issues.
/Thanks
I had a decent amount of success with https://github.com/insin/nwb. It is very heavy dependency wise but otherwise it works well and produces all kinds of outputs you could wish for, es6, es5, and umd.
I'm not sure if @gaearon is aware of this thread, but I think it is somehow correlated to https://github.com/facebookincubator/create-react-app/issues/1107 and also quite important to understand the purpose of create-react-app.
I've been creating projects that have the same design language and to avoid technically repeating myself, I came to the most concise solution React brought: modularity. For this reason, I started to build a UI kit. At the very beginning, I got stuck. The reason is simple: my projects, powered by create-react-app, aren't ready to deal with local packages.
I tried some solutions (the one I came up is described here), but none of them were good enough to make me fully productive.
For that reason, and seeing the module @tbillington shared, I figured that create-react-app is not the way to go for libs/components. I mean, it describes itself very well by its name.
I am nobody to say what CRA is or what it is not, but I'd say that your words are precisely correct:
Maybe this is not suitable for this project. In that case, please point me to relevant projects that address this issues.
But I'm here to manifest curiosity towards a create-react-lib and if it wasn't the initial intentions of Facebook when they built the sketches for create-react-app. And only between us: CRA is just great. nwb looks cool too, but the lack of jest to test makes it unusable for me.
@chiefGui If jest is the only thing holding you back, https://github.com/insin/nwb/issues/173 馃槢 .
Going to close since we don鈥檛 intend to support something like this in near future, but please feel free to use nwb for this, I heard it鈥檚 great!
Ok @gaearon. Thanks for the feedback. Will look into nwb.
See also discussion in https://github.com/facebookincubator/create-react-app/issues/1492 and past discussions linked from it.
Most helpful comment
@chiefGui If jest is the only thing holding you back, https://github.com/insin/nwb/issues/173 馃槢 .