apps/web/package.json and support multiple environment configurations.
Prerequisites
Before building the web vault, ensure you have:- Node.js (version specified in root
package.json) - npm or yarn
- Dependencies installed via
npm installfrom the repository root
Development Builds
Development Server
For local development with hot reload: OSS (Open Source) Version:NODE_OPTIONS flag increases memory allocation to 8GB for large builds.
Self-Hosted Development
OSS Self-Hosted:Production Builds
Cloud Environments
Production Cloud (US):Self-Hosted Production
OSS Self-Hosted Production:Distribution Builds
For creating distribution artifacts: Cloud Distribution:Build Configuration
Webpack Configurations
The web vault uses different webpack configurations: OSS Configuration:- File:
apps/web/webpack.config.js - Entry:
apps/web/src/main.ts - Module:
src/app/app.module#AppModule
- File:
bitwarden_license/bit-web/webpack.config.js - Entry: Same as OSS but with commercial features
- Module: Extended AppModule with enterprise features
Base Configuration
Both configurations extend fromapps/web/webpack.base.js, which:
- Handles environment variable injection via
config.js - Configures loaders for TypeScript, SCSS, HTML, and assets
- Sets up Angular compilation with
@ngtools/webpack - Manages code splitting and optimization
Environment Variables
Builds are controlled by two environment variables:ENV: Deployment environment
development- Local developmentselfhosted- Self-hosted deploymentscloud- US production cloudqa- QA environmenteuprd- EU productioneuqa- EU QAusdev- US developmentee- Enterprise edition
NODE_ENV: Build mode
development- Development build (source maps, no minification)production- Production build (minified, optimized)
Build Analysis
To analyze bundle size and composition:- Builds the application with profiling enabled
- Outputs statistics to
stats.json - Opens an interactive bundle analyzer in your browser
Testing
Run Tests:Build Output
By default, builds output to:- Directory:
apps/web/build/ - Entry Point:
index.html - Assets: Fonts, images, compiled CSS and JS bundles
Common Issues
Memory Issues
If you encounter out-of-memory errors during builds:Port Conflicts
Webpack serve uses default port 8080. If the port is in use, webpack will automatically try the next available port.Environment Configuration
Environment configurations are loaded fromapps/web/config.js based on the ENV variable. Ensure your target environment is properly configured in this file.