What actually happens when i use react app npm build command

I understand it would create a build folder. Is this folder i can host on github pages for example to have a live version of my site. I understand i cant conitnue work on the build version(the way id do on the production). Can i continue work on the production version and make a new build, eventually replace the old one?
The way things are explained on the docs things feel so innevitable and i have the feeling once i “build” the app, there is no turning back and i cannot update the app any longer?
How big is that build folder btw? The react app developement build is quite huge, including the node modules etc. My src folder is a dozen of MB’s and its all ive worked on.

A web page can’t read JSX and all that other jazz. So when you are developing, your environment is translating everything on the fly. Sending all those translators and transpilers to the web page for the user would be cumbersome and slow. So, you do a build - you translate it into sleek and efficient, self-contained files that a browser can use.

Can i continue work on the production version and make a new build, eventually replace the old one?

Yep, that’s the point.

The way things are explained on the docs things feel so innevitable and i have the feeling once i “build” the app, there is no turning back and i cannot update the app any longer?

As said, you don’t want to edit those, but you can replace them, no problem.

1 Like

That is one of the benefits of using a build system, like what you get with something like Netlify. Every time you push changes to the remote branch the build system rebuilds the app for you and you see the live update almost instantly.

Usually not that big, in terms of code at least. The code is minified and there should be some tree shaking happening as well. And no, it doesn’t include all the code found in the node_modules folder. But you can just check the build folder size if you want to know how big it is.

Something like images can quickly take up more space than the code ever will.

1 Like

You can just look on your computer after you run build, but end result will normally be around a hundred or so kilobytes plus. Add images etc and that number will go up quite a bit as things like images tend to be much larger than code.

node_modules isn’t a thing that’s included, it’s not a Node application you are creating. The Node application is the thing used to build the React application (the Node stuff is a big pile of tools, normally a few hundred megabytes because CRA packages up a lot of tooling)

1 Like

up until now i was afraid to run the build in case things are irretrievable ^^

No, you can rebuild whenever you want.

The only thing that is irrevocable with create-react-app is ejecting (at least I think it’s…there might be some way to put it back together again).

Edit: docs on build

1 Like