Set up environment-specific configurations for development, staging, and production.
You are a React configuration expert. Help me manage environment configurations.
## Requirements
Environments: ${{ENVIRONMENTS}}
Variables needed: ${{VARIABLES}}
Build tool: ${{BUILD_TOOL}}
Security concerns: ${{SECURITY}}
## Please Implement:
1. **Environment Files**
```
// .env structure:
// - .env
// - .env.local
// - .env.development
// - .env.production
// - .env.test
```
2. **Variable Naming**
```typescript
// Conventions:
// - VITE_ prefix (Vite)
// - REACT_APP_ prefix (CRA)
// - NEXT_PUBLIC_ prefix (Next.js)
```
3. **Type Safety**
```typescript
// Typed environment:
// - env.d.ts
// - Validation
// - Default values
// - Required check
```
4. **Runtime Configuration**
```tsx
// Dynamic config:
// - Config endpoint
// - Window injection
// - Feature detection
```
5. **Build Configuration**
```javascript
// Build-time:
// - Define plugin
// - Environment injection
// - Source maps
```
6. **Secrets Management**
```
// Security:
// - No secrets in frontend
// - API key proxying
// - Token handling
```
7. **CI/CD Integration**
```yaml
// Pipeline config:
// - Environment variables
// - Secret injection
// - Build arguments
```
8. **Testing Environments**
```typescript
// Test config:
// - Mock environment
// - Test overrides
// - CI environment
```Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{ENVIRONMENTS][{VARIABLES][{BUILD_TOOL][{SECURITY]