Create-react-app: Thoughts on "create-react-lib"

Created on 19 Dec 2016  路  6Comments  路  Source: facebook/create-react-app

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:

  • [聽] stable generated output/dist lib to put in the package.json/index entry
  • [ ] option to, maybe optionally, embeed assets (i.e.: styles)

Maybe this is not suitable for this project. In that case, please point me to relevant projects that address this issues.

/Thanks

Most helpful comment

@chiefGui If jest is the only thing holding you back, https://github.com/insin/nwb/issues/173 馃槢 .

All 6 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ap13p picture ap13p  路  3Comments

jnachtigall picture jnachtigall  路  3Comments

adrice727 picture adrice727  路  3Comments

wereHamster picture wereHamster  路  3Comments

onelson picture onelson  路  3Comments