Prerequisites
Before building, ensure you have:- Node.js installed (version specified in root package.json)
- Dependencies installed:
npm installfrom the repository root
Build Commands
All build commands are defined inapps/browser/package.json.
Development Builds
Build for a specific browser in development mode:Production Builds
For production-ready builds with optimizations:Build Configuration
Environment Variables
Builds are configured using environment variables:BROWSER- Target browser (chrome,firefox,safari,edge,opera)MANIFEST_VERSION- Manifest version (2or3)NODE_ENV- Build mode (developmentorproduction)NODE_OPTIONS- Node.js options (set to--max-old-space-size=8192for memory)
Example Build Command Breakdown
Here’s what happens when you runnpm run build:chrome:
Set Environment Variables
cross-env sets:BROWSER=chrome- Target Chrome browserMANIFEST_VERSION=3- Use Manifest V3NODE_OPTIONS="--max-old-space-size=8192"- Allocate 8GB RAM for build
Browser Targets
Chrome (Default)
build/ directory with Chrome-compatible extension
Firefox
- Uses
browser.*namespace instead ofchrome.* - Supports sidebar action
- Android support available
Safari
- Requires Xcode and Safari developer tools
- Native app wrapper needed for distribution
- Additional packaging step:
./scripts/package-safari.ps1
Edge
Opera
Watch Mode for Development
Watch mode automatically rebuilds when source files change:- Monitors source files for changes
- Automatically rebuilds on save
- Preserves build output in
build/directory - Does NOT reload the extension in the browser (manual reload required)
Distribution Builds
Create production builds packaged as ZIP files for distribution:- Build production version
- Create
dist/directory - Compress to ZIP:
scripts/compress.sh dist-{browser}.zip
Distribution Output
ZIP files are created in thedist/ directory:
dist-chrome.zip- Chrome Web Storedist-firefox.zip- Firefox Add-onsdist-edge.zip- Microsoft Edge Add-onsdist-opera.zip- Opera Add-ons
Webpack Configuration
The build system uses a modular webpack configuration:Entry Points
- Popup:
src/popup/main.ts- Angular application for the extension popup - Background:
src/platform/background.ts- Service worker entry point - Content Scripts: Configured in manifest, built separately
Loading in Browser for Testing
After building, load the extension in your browser:Open Extension Management
- Chrome: Navigate to
chrome://extensions/ - Firefox: Navigate to
about:debugging#/runtime/this-firefox - Edge: Navigate to
edge://extensions/
Enable Developer Mode
Toggle “Developer mode” switch (Chrome/Edge) or click “Load Temporary Add-on” (Firefox)
Common Build Issues
Out of Memory Errors
If builds fail with out-of-memory errors:TypeScript Errors
Clear TypeScript cache:Manifest Version Conflicts
Ensure the correct manifest version for your target browser:Next Steps
- Architecture - Understand the extension architecture
- Manifest V3 - Learn about Manifest V3 specifics