1

I have to run npm run build for any small changes on the app, even for a text box. However, it gets annoying and inefficient when the application size gets bigger and bigger. Is there any way of taking a build for the only part that is changed?

My package.json file includes:

  "scripts": {
    "build": "react-scripts build"
  }
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Wokers
  • 107
  • 3
  • 13
  • It's impossible to say, we don't even know what your build process _is_. – jonrsharpe Feb 24 '22 at 07:48
  • my mistake, i referred to "npm run build" but what I meant is "npm build". @jonrsharpe – Wokers Feb 24 '22 at 08:18
  • There is no `npm build`, it asks if you meant `npm run build`: https://docs.npmjs.com/cli/v8/commands. Please give more information about your setup, or just research your build tool's options for caching, optimising or otherwise speeding up the process. – jonrsharpe Feb 24 '22 at 08:21
  • I updated again the question..Sorry for the ambiguity. – Wokers Feb 24 '22 at 08:30

1 Answers1

-2

npm run build runs the script "build" and creates a script which runs your application (say server.js). So in order to view the changes made by you and ensure its effect on the application, you need to run this command.

It is not always obvious that you would see errors in the page containing that particular component. Sometimes, due to any other component or any third-party libraries there can be conflict somewhere else. So, it is always the best practice to check and test your changes simultaneously. So, in my opinion even companies like Facebook would re run this command for small changes as well.

muskaan sharma
  • 127
  • 1
  • 4
  • 11