npm run dev
: Runs and automatically restarts the server whenever changes are made.- Uses nodemon, a tool that watches for file changes in the current directory and subdirectories.
- When changes are detected, it automatically restarts the specified JavaScript file using the Node.js runtime.
- This provides a more streamlined development workflow, as you can focus on coding without needing to manually restart the application every time you make changes.
- Used during development.
npm run build
: Cleans the./build
directory and builds the app into it.npm run preview
: Runs the server once.- Directly executes the specified JavaScript file using the Node.js runtime. It's a one-time execution, and if you make changes to the code, you need to manually stop and restart the command each time to see the changes take effect.
- Used in "production".