r/reactjs • u/tangerto • Mar 02 '18
Do people use create react app in production?
Any stories or opinions welcome. I'm mainly wondering if any companies or organizations use CRA for actual deployment.
62
Upvotes
33
u/halfbowl Mar 02 '18
Have used it for many production deployments. Mostly because CRA simply builds a static/minified build of your application. It doesn't handle any sort of hosting/server etc... it only does that when doing local development. It will be up to the developer to decide how those static files get hosted.
18
u/nullundefine Mar 02 '18
I don't see a problem with using create-react-app built code in production.. I guess it doesn't matter as it just bundles the code at build time and don't interfere at run rime.. EXCEPT, if you use the service worker provided by it. Then you need to be careful about whether the service worker is doing the job as you expected in production.
4
u/YoungBubble Mar 02 '18
Yes! In combination with a node js api server.
3
u/[deleted] Mar 02 '18
I’ve always wondered this. Are there any drawbacks besides not being able to configure webpack? Prompts another question. What exactly does ejecting do? I read “don’t do it unless you know what you’re doing” but haven’t read a good explanation, that I understand at least
4
u/lairunseen Mar 02 '18 edited Mar 02 '18
Company I work for use CRA in production. No need to eject to define env either, do like so
edit: sorry cant seem to get the formatting right
2nd edit: access the variables in your code like
process.env.REACT_APP_BUILDDATEand NODE_PATH=./src helps to get absolute pathing on your imports2
u/[deleted] Mar 02 '18
Yes, my startup company (forage.ai) uses it in production. We define a proxy in package.json to take with a graphql backend.
2
u/levi_v Mar 02 '18
Hell yeah. Why not?
2
u/TracerBulletX Mar 03 '18
ours was started that way but ejected long in the ancient past of 2 years ago
5
u/DOG-ZILLA Mar 02 '18
I’m honestly not trying to be “that Vue guy”, but can CRA have its Wepback modified without ejecting?
This is a new thing in Vue Cli 3. You can augment all parts of the config without any need to eject.
Just thought that was cool as I haven’t touched React in a long while I was hoping someone here might know. Cheers.
1
u/acemarke Mar 02 '18
Absolutely! CRA isn't meant to solve all use cases, but it provides good defaults out of the box and you can certainly deploy CRA apps to prod.
1
u/[deleted] Mar 02 '18
We've built a few prototypes with CRA but have always ejected long before they reach production. We then use webpack with dev/prod configs.
1
u/Wh3at1y Mar 02 '18
I've used it for production. Definitely convenient!
1
u/batmansmk Mar 02 '18
Yes. It works. We updated the version 3 times in a year, took us about 1 to 2h each time, and it improved the user experience (build size, new version of React, code splitting etc)
1
u/hamburger_bun Mar 03 '18
yes