LinuxCommandLibrary

react-scripts

TLDR

Start development server

$ react-scripts start
copy
Build for production
$ react-scripts build
copy
Run tests
$ react-scripts test
copy
Eject configuration
$ react-scripts eject
copy

SYNOPSIS

react-scripts command [options]

DESCRIPTION

react-scripts is the build tool for Create React App. It encapsulates webpack, Babel, ESLint, and other tools with zero configuration, handling development server, building, and testing.

EXAMPLES

$ # Start dev server (port 3000)
npm start
# or
react-scripts start

# Production build
npm run build
# Creates build/ directory

# Run tests
npm test

# Run tests with coverage
npm test -- --coverage

# Eject (one-way operation)
npm run eject
copy

COMMANDS

start

Start development server.
build
Create production build.
test
Run test suite.
eject
Expose configuration files.

ENVIRONMENT VARIABLES

$ PORT=3001 npm start              # Custom port
BROWSER=none npm start           # Don't open browser
GENERATE_SOURCEMAP=false npm build  # No sourcemaps
CI=true npm test                 # CI mode
copy

PROXY SETUP

$ // package.json
{
  "proxy": "http://localhost:5000"
}
copy

CAVEATS

Eject is irreversible. Limited customization without ejecting. Consider CRACO for config overrides.

HISTORY

react-scripts was created by Facebook as part of Create React App (2016) to simplify React development setup.

SEE ALSO

Copied to clipboard