Search code examples
reactjsnpm-scripts

Do I need to rebuilt a React app after making changes to the source code?


I have just completed my portfolio website in react app and use npm run build command to generate a build folder and used that build folder to host my portfolio on netlify, but now after some reviews from my colleagues I have decided to change some things on the code. Do I have to run build command again in the terminal to create a new build folder đź“‚ with updated changes so that I can host it again?

I have seen online tutorials but I couldn't understand it there, that's why I am asking here from experienced people, please help


Solution

  • If you've hosted it as a Reactjs app then you don't have to run npm build again, netlify would automatically run it on every change to the github repo, given the correct preference have be set. To ensure you can run deploy again from your netlify console. Deploy Guide

    In case you've hosted just with the files inside the build folder choosing HTML template in netlify, you'd have to run npm build every time you make changes to your app code and update the same to your github repo/netlify.