React › Build Tools & Bundlers (Vite, Webpack & CRA)

What is the difference between a development server and a production build in a React project?

Beginner

Answer

A development server, started with a command like npm run dev, shows helpful error messages and updates the page instantly as you save changes, but the code is not optimized for speed. A production build, created with npm run build, produces smaller and faster files that are meant to be uploaded to a real server for actual visitors to use.
npm run dev    // starts a local server for coding, with helpful errors
npm run build  // creates a fast, optimized version ready for real users
Real-world example A developer tests their new feature using npm run dev on their own computer, and once everything works correctly, runs npm run build to create the final files that get uploaded to the live website.

Common follow-ups: Why should you never deploy the development version of a React app to real users?;What files does the production build actually create?