Skip to main content
The Bitwarden Web Vault uses Webpack for building and serving the application. Build scripts are defined in 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 install from the repository root

Development Builds

Development Server

For local development with hot reload: OSS (Open Source) Version:
This runs:
Commercial Version:
This runs:
The NODE_OPTIONS flag increases memory allocation to 8GB for large builds.

Self-Hosted Development

OSS Self-Hosted:
Equivalent to:
Commercial Self-Hosted:
Equivalent to:

Production Builds

Cloud Environments

Production Cloud (US):
Runs:
QA Environment:
Runs:
EU Production:
Runs:
EU QA:
Runs:
US Development:
Runs:
Enterprise Edition:
Runs:

Self-Hosted Production

OSS Self-Hosted Production:
Runs:
Commercial Self-Hosted Production:
Runs:

Distribution Builds

For creating distribution artifacts: Cloud Distribution:
OSS Self-Hosted Distribution:
Commercial Self-Hosted 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
Commercial Configuration:
  • 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 from apps/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 development
  • selfhosted - Self-hosted deployments
  • cloud - US production cloud
  • qa - QA environment
  • euprd - EU production
  • euqa - EU QA
  • usdev - US development
  • ee - 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:
This runs:
The command:
  1. Builds the application with profiling enabled
  2. Outputs statistics to stats.json
  3. Opens an interactive bundle analyzer in your browser

Testing

Run Tests:
Runs Jest test suite once. Watch Mode:
Runs tests in watch mode for files you’ve changed. Watch All:
Runs all tests in watch mode.

Build Output

By default, builds output to:
  • Directory: apps/web/build/
  • Entry Point: index.html
  • Assets: Fonts, images, compiled CSS and JS bundles
The output structure includes:

Common Issues

Memory Issues

If you encounter out-of-memory errors during builds:
The development watch scripts already include this flag.

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 from apps/web/config.js based on the ENV variable. Ensure your target environment is properly configured in this file.