1

So, I have a React app, which is live on production using serve.

These are the commands I've used for doing so:

NODE_ENV=production react-scripts build

NODE_ENV=production serve -s build

So that's production done! But now I want to do the same thing on the development server. I've tried this:

NODE_ENV=development react-scripts build

NODE_ENV=development serve -s build

But that still compiles as the production build, and even serve starts on production mode.

How can I build and run using react-scripts & serve on development mode?


I don't want to:

  1. Run via npm run start, since that crashes my server (by consuming a lot of resources while compiling)
  2. Use dotenv for setting environment variables, since that's third-party.

0 Answers0