Overview
Theevershop dev command starts a development server with automatic reloading when source files change. It’s designed for local development with TypeScript compilation, webpack hot module replacement, and file watching.
Usage
What It Does
1. TypeScript Compilation
The dev command automatically compiles TypeScript files in your project:- Compiles all
.tsand.tsxfiles - Watches for changes and recompiles
- Uses SWC for fast compilation
2. File Watching
Monitors your source files for changes:- Watches TypeScript/JavaScript files
- Watches React components
- Watches GraphQL schemas
- Watches configuration files
3. Hot Module Replacement
Webpack HMR enables:- Live reload of React components
- CSS updates without page refresh
- Preserves application state during updates
4. Development Server
Starts an Express server with:- Development middleware
- Source maps for debugging
- Detailed error messages
- Hot reload endpoints
Environment
When running in development mode:NODE_ENVis set todevelopmentALLOW_CONFIG_MUTATIONSis enabled- Detailed logging is enabled
- Source maps are generated
Process Architecture
The dev command uses a multi-process architecture:- Main Process: Spawns and manages the dev server
- Child Process: Runs the actual application
- Auto-restart: Child process restarts when critical files change
Automatic Restart
The server automatically restarts when:- Bootstrap scripts change
- Core configuration files change
- Module structure changes
- GraphQL schemas change
Port Configuration
The development server port can be configured:3000. The server will log the URL on startup:
File Structure
Key files monitored during development:Development Workflow
Typical development workflow:Debugging
Enable Debug Logs
Set the DEBUG environment variable:Source Maps
Source maps are automatically generated for:- TypeScript files
- JavaScript bundles
- CSS files
Performance
First Start
- Compiles all TypeScript files
- Builds initial webpack bundles
- Initializes database connections
- Loads all modules and extensions
Subsequent Changes
- Hot reload: 1-2 seconds
- TypeScript compilation: 2-5 seconds
- Full restart: 10-15 seconds
Troubleshooting
Port Already in Use
config/default.json or kill the process:
Module Not Found Errors
TypeScript Compilation Errors
Database Connection Errors
.env file has correct database credentials:
Differences from Production
| Feature | Development | Production |
|---|---|---|
| Hot Reload | Yes | No |
| Source Maps | Yes | No |
| Minification | No | Yes |
| Caching | Minimal | Aggressive |
| Logging | Verbose | Errors only |
| Performance | Slower | Optimized |
Related Commands
evershop build- Build for productionevershop start- Start production serverevershop install- Initial setup