@react-router/dev (CLI)
On this page

React Router CLI

The React Router CLI comes from the @react-router/dev package. Make sure it is in your package.json devDependencies so it doesn't get deployed to your server.

To get a full list of available commands and flags, run:

npx @react-router/dev -h

react-router build

Builds your app for production with Vite. This command will set process.env.NODE_ENV to production and minify the output for deployment.

react-router build
Flag Description Type Default
--assetsInlineLimit Static asset base64 inline threshold in bytes number 4096
--clearScreen Allow/disable clear screen when logging boolean
--config, -c Use specified config file string
--emptyOutDir Force empty outDir when it's outside of root boolean
--logLevel, -l Use specified log level "info" | "warn" | "error" | "silent" | string
--minify Enable/disable minification, or specify minifier to use boolean | "terser" | "esbuild" "esbuild"
--mode, -m Set env mode string
--profile Start built-in Node.js inspector
--sourcemapClient Output source maps for client build boolean | "inline" | "hidden" false
--sourcemapServer Output source maps for server build boolean | "inline" | "hidden" false

react-router dev

Runs your app in development mode with HMR and Hot Data Revalidation (HDR), powered by Vite.

react-router dev

What is "Hot Data Revalidation"?

Like HMR, HDR is a way of hot updating your app without needing to refresh the page. That way you can keep your app state as your edits are applied in your app. HMR handles client-side code updates like when you change the components, markup, or styles in your app. Likewise, HDR handles server-side code updates.

That means any time you make a change to the current page (or any code that your current page depends on), React Router will re-fetch data from your loaders. That way your app is always up to date with the latest code changes, client-side or server-side.

Flag Description Type Default
--clearScreen Allow/disable clear screen when logging boolean
--config, -c Use specified config file string
--cors Enable CORS boolean
--force Force the optimizer to ignore the cache and re-bundle