Overview
Proton WebClients applications are built using webpack via the@proton/pack build system. Each application can be run in development mode or built for production.
Development Mode
Starting an Application
Run an application in development mode with hot reload:Development servers run in standalone mode by default. The application will be available at
http://localhost:<port>.Development Server Options
Theproton-pack dev-server command supports various options:
Application mode:
standalone or ssoSuppress error logs in console
Disable logical CSS properties transformation
Example: Custom Development Configuration
Production Builds
Building for Production
Build an application for production deployment:- Mail
- Drive
- Calendar
- Pass
Build Output
Production builds output to the
dist/ directory within each application workspace.turbo.json
Build Analysis
Analyzing Bundle Size
Generate a webpack bundle analyzer report:--analyze flag:
Type Checking
Check TypeScript Types
Run TypeScript compiler in check mode (no output):- Single Application
- All Workspaces
Type checking runs the
tsc command defined in each workspace’s scripts.Application Scripts Reference
Common Scripts
All applications share these common scripts:| Script | Description | Command |
|---|---|---|
start | Start development server | proton-pack dev-server |
build:web | Production build | proton-pack build |
check-types | TypeScript type checking | tsc |
lint | Run ESLint | eslint --quiet |
test | Run tests | jest |
test:ci | CI test run | jest --ci --coverage |
Application-Specific Examples
Mail
package.json
Drive
Drive
package.json
Calendar
Calendar
package.json
Pass
Pass
package.json
Build System (@proton/pack)
The@proton/pack package provides the build tooling for all applications.
Key Features
Webpack Configuration
Pre-configured webpack setup with optimized loaders and plugins
TypeScript Support
Built-in TypeScript compilation with Babel
Hot Reload
React Fast Refresh for instant feedback
Asset Optimization
Automatic image and asset optimization
Proton Pack CLI
Theproton-pack command provides:
dev-server- Development server with hot reloadbuild- Production build with optimizations
Environment Variables
Common Environment Variables
Node environment:
development or productionPath to TypeScript configuration for webpack
Number of parallel webpack processes
Troubleshooting
Build fails with memory error
Build fails with memory error
Increase Node.js memory limit:
Development server port conflict
Development server port conflict
The dev server uses
portfinder to automatically find an available port. Check console output for the actual port.TypeScript errors in build
TypeScript errors in build
Run type checking separately to see detailed errors:
Stale build cache
Stale build cache
Clear webpack cache: