This seems like a simple question, but I couldn't find an answer in the Next documentation. If I have started a Next.js server:
$ npm run start
and I get an update to the site:
$ git pull
can I re-build the server:
$ npm run build
while it's still running ... or will that crash the server?
If it will crash it, is the a best practice to build everything to a separate directory, and then copy it over to deploy?
I had the same thought, every time I update my code and build it for production, I am stopping my server and restarting it.
To experiment, I tried:
npm run build.
npm run start.
Then, made a change to the code.
I kept the server running.
and in a different terminal window,I did npm run build.
But, unfortunately, it crashed the app.
So, I had to stop the server and ran npm run start
again in the original terminal window.
Unless it is a completely static site or in dev mode, I think stopping and restarting the server is necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With