Redux Development & Deployment Guide
Prerequisites
- Node.js: LTS version (18.x or 20.x recommended)
- Package Manager: npm (v9+), yarn, or pnpm
- Git: For cloning and version control
- TypeScript: Global installation optional (project uses local version)
Installation
1. Clone the Repository
git clone https://github.com/reduxjs/redux.git
cd redux
2. Install Dependencies
Root package (Library):
npm install
Documentation Website:
cd website
npm install
cd ..
Configuration
Environment Variables (Optional)
For the documentation site analytics (production builds only):
# In website/.env.local
UMAMI_WEBSITE_ID=your_analytics_id
UMAMI_SRC=https://your-analytics-source.com/script.js
TypeScript Configuration
The project uses strict TypeScript settings defined in tsconfig.json. No additional configuration required for standard development.
Build & Run
Library Development
Build the Redux core:
npm run build
Run tests:
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run type checking
npm run type-check
Linting and formatting:
# Check code style
npm run lint
# Fix auto-fixable issues
npm run lint:fix
# Format with Prettier
npm run format
Documentation Website
Start development server:
cd website
npm run start
Access at http://localhost:3000 (Docusaurus default).
Build for production:
cd website
npm run build
Output generated in website/build/ directory.
Serve production build locally:
cd website
npm run serve
Deployment
Publishing the Library (Maintainers Only)
# 1. Update version in package.json
# 2. Build distribution files
npm run build
# 3. Run tests
npm test
# 4. Publish to npm
npm publish
# For pre-releases
npm publish --tag next
Deploying Documentation
The Redux documentation site (redux.js.org) is deployed via CI/CD pipeline:
Manual deployment (if needed):
cd website
npm run build
# Deploy website/build/ contents to static hosting
Recommended Platforms:
- Vercel: Connect GitHub repo, set root directory to
website - Netlify: Build command
npm run build, publish directorybuild - GitHub Pages: Use
gh-pagesbranch withwebsite/buildcontents
Troubleshooting
Build Issues
TypeScript compilation errors:
- Ensure you're using Node.js LTS version (check with
node -v) - Delete
node_modulesandpackage-lock.json, then runnpm installagain - Check that TypeScript version matches the one in
devDependencies
"Cannot find module" errors:
- Verify all dependencies installed:
npm install - For website-specific errors, ensure you're in the
website/directory when running commands
Test Failures
Jest/Testing environment issues:
# Clear Jest cache
npm run test -- --clearCache
# Run specific test file
npm run test -- src/createStore.test.ts
Documentation Site Issues
Docusaurus build fails:
- Ensure Node.js version ≥ 18
- Check for broken Markdown links:
cd website && npm run buildshows specific files - If search plugin errors occur, ensure
@getcanary/docusaurus-theme-search-pagefindis properly installed
Code block transpilation errors:
The docs use remark-typescript-tools to transpile TS examples. If examples fail to render:
- Verify TypeScript syntax in Markdown files
- Check browser console for transpilation errors
Package Manager Conflicts
If using yarn or pnpm instead of npm:
- Delete existing
package-lock.jsonfirst to avoid lockfile conflicts - The project is primarily tested with npm; yarn/pnpm may require additional
resolutionsoroverridesfor peer dependencies
Legacy createStore Warnings
When testing the core library, you may see deprecation warnings for createStore. This is expected behavior directing users to Redux Toolkit. To suppress during development testing:
import { legacy_createStore as createStore } from 'redux'