This document provides comprehensive instructions for building the Backpack browser extension from source.
- Node.js: v20.10.0 (exact version required)
- Yarn: v4.0.2 or higher
- Git: For version control
- Bun (optional): For faster builds
Using nvm (recommended):
# Install nvm if not already installed
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Install Node.js 20.10.0
nvm install 20.10.0
# Use Node.js 20.10.0
nvm use 20.10.0
# Verify installation
node --version # Should output: v20.10.0# Enable corepack (comes with Node.js)
corepack enable
# Verify yarn installation
yarn --version # Should output: 4.0.2 or higher# 1. Ensure correct Node version
source ~/.nvm/nvm.sh
nvm use 20.10.0
# 2. Install dependencies
yarn install
# 3. Build the extension
./build-clean.shThe built extension will be located at: packages/app-extension/build/
The build-clean.sh script performs a complete clean build:
./build-clean.shWhat it does:
-
Cleans all build caches:
.turbo/(Turborepo cache)node_modules/.cache/(Module caches)packages/*/dist/(Distribution folders)packages/*/.turbo/(Package-level turbo caches)packages/*/build/(Build outputs)
-
Builds packages using Bun (if available) or Yarn:
- Builds all workspace packages in dependency order
- Uses Turborepo for parallel builds
- Caches successful builds for faster rebuilds
-
Verifies the build:
- Checks manifest.json version matches source
- Validates build artifacts exist
-
Updates timestamps on critical files
If you need more control:
# 1. Clean caches manually
rm -rf node_modules/.cache .turbo packages/*/dist packages/*/.turbo packages/*/build
# 2. Install dependencies
yarn install
# 3. Build all packages
yarn build
# Or build just the extension
npx turbo run build --filter=@coral-xyz/app-extensionFor faster development builds without cleaning:
# Build without cleaning cache
yarn build
# Or watch mode for development
cd packages/app-extension
yarn startError:
ERROR: React type incompatibilities
'View' cannot be used as a JSX component
Solution:
# Switch to Node 20.10.0
nvm use 20.10.0
# If not installed, install it first
nvm install 20.10.0
nvm use 20.10.0
# Verify
node --versionError:
Type 'React.ReactNode' is not assignable to type
'import(".../react-test-renderer/.../@types/react/index").ReactNode'
Solution:
# Deduplicate React type packages
yarn dedupe "@types/react"
yarn dedupe "@types/react-dom"
# Reinstall dependencies
rm -rf node_modules
yarn install
# Rebuild
./build-clean.shSymptoms:
- Builds fail unexpectedly
- Changes not reflected in build output
- Stale dependencies
Solution:
# Method 1: Use build-clean.sh (cleans everything)
./build-clean.sh
# Method 2: Manual cache cleaning
rm -rf .turbo
rm -rf node_modules/.cache
rm -rf packages/*/.turbo
yarn install
yarn buildError:
Cannot find module '@coral-xyz/...'
Solution:
# Clean reinstall
rm -rf node_modules
rm -rf yarn.lock # Only if necessary
yarn installError:
TS2786: '...' cannot be used as a JSX component
Solution: This usually indicates wrong Node version or duplicate types. Follow solutions for Issues 1 and 2.
After successful build, the extension will be at:
packages/app-extension/build/
├── manifest.json # Extension manifest (v3)
├── background.js # Background service worker (3.6MB)
├── contentScript.js # Content script injected into pages (350KB)
├── injected.js # Provider injection script (3.4MB)
├── popup.html # Extension popup HTML
├── popup.js # Extension popup logic (17MB)
├── options.html # Options page HTML
├── options.js # Options page logic (17MB)
├── permissions.html # Permissions page HTML
├── permissions.js # Permissions page logic (667KB)
├── icons/ # Extension icons
├── *.png # Logo assets (x1.png, solana.png)
└── *.js # Code-split chunks
chrome://extensions/
Or: Menu → More Tools → Extensions
Toggle "Developer mode" in the top-right corner.
Click "Remove" on any existing Backpack extension.
- Click "Load unpacked"
- Navigate to:
/home/jack/backpack/packages/app-extension/build - Select the
buildfolder - Click "Select"
Check that:
- Extension name: "Backpack"
- Version: 0.10.61 (or your current version)
- Status: Enabled
- No errors shown
- Close all browser tabs (important for clean state)
- Open a new tab
- Click the Backpack extension icon
- Verify the extension opens correctly
Symptoms:
- "Manifest file is missing or unreadable"
- Extension icon grayed out
Solution:
# Verify build exists
ls -la packages/app-extension/build/
# Rebuild if necessary
./build-clean.sh
# Check manifest is valid JSON
cat packages/app-extension/build/manifest.json | jq '.'Symptoms:
- Changes not reflected
- Old features still present
Solution:
# 1. In Chrome: Remove the extension completely
# 2. Clear Chrome cache
rm -rf ~/.cache/google-chrome/*
rm -rf ~/.config/google-chrome/Default/Service\ Worker/*
# 3. Close Chrome completely
killall chrome
# 4. Rebuild
./build-clean.sh
# 5. Restart Chrome and reload extensionCheck Console:
- Right-click extension icon → "Inspect popup"
- Check Console for errors
- Look for:
- Network errors (feature gates, RPC)
- localStorage errors
- React rendering errors
-
Use Bun (if available):
curl -fsSL https://bun.sh/install | bash ./build-clean.sh # Will automatically use Bun
-
Skip unnecessary packages:
# Build only extension npx turbo run build --filter=@coral-xyz/app-extension -
Use Turbo cache:
# After first build, subsequent builds use cache yarn build # Much faster than build-clean.sh
-
Parallel builds: Turborepo automatically parallelizes builds based on dependency graph.
- First clean build: ~1-2 minutes
- Cached rebuild: ~10-30 seconds
- Watch mode (development): Instant on file changes
The build process respects these environment variables:
# Production build (default for build-clean.sh)
NODE_ENV=production
# Development build (includes source maps, faster)
NODE_ENV=development
# Skip TypeScript type checking (faster but risky)
SKIP_TYPE_CHECK=trueFor automated builds:
#!/bin/bash
set -e # Exit on error
# Ensure correct Node version
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm use 20.10.0
# Install dependencies
yarn install --frozen-lockfile
# Deduplicate types (prevent CI failures)
yarn dedupe "@types/react"
yarn dedupe "@types/react-dom"
# Build
./build-clean.sh
# Verify build output
test -f packages/app-extension/build/manifest.json || exit 1packages/
├── app-extension/ # Browser extension (main output)
├── background/ # Extension background logic
├── common/ # Shared utilities
├── data-components/ # Data fetching components
├── recoil/ # State management
├── secure-background/ # Secure background process
├── secure-clients/ # Secure client communications
├── secure-ui/ # Secure UI components
├── tamagui-core/ # UI component library
└── react-common/ # Common React components
common,i18n,wallet-standardsecure-background,secure-clientsprovider-core,recoil,tamagui-corereact-common,data-components,backgroundsecure-ui,app-extension
After building, verify:
- Build completed without errors
-
packages/app-extension/build/directory exists -
manifest.jsonversion matches source - All JS files present (background, popup, options, etc.)
- Assets copied (icons, PNGs)
- Extension loads in Chrome without errors
- Popup opens and displays correctly
- No console errors in extension popup
package.json- Root package configurationturbo.json- Turborepo configurationtsconfig.json- TypeScript configurationbuild-clean.sh- Clean build script
packages/app-extension/webpack.config.js- Production configpackages/app-extension/webpack.dev.config.js- Development config
# Check which packages would be built
npx turbo run build --dry-run
# Build specific package
npx turbo run build --filter=@coral-xyz/tamagui
# Clear all Turbo caches
npx turbo run build --force
# Lint before building
yarn lint
# Format code
yarn format:allIf you encounter issues not covered here:
- Check git history:
git log --oneline -20 - Check Node version:
node --version(must be 20.10.0) - Check dependencies:
yarn why <package-name> - Clean everything:
rm -rf node_modules yarn.lock .turbo packages/*/node_modules packages/*/dist nvm use 20.10.0 yarn install ./build-clean.sh
The script currently has no command-line options but can be modified to support:
# Potential future enhancements:
./build-clean.sh --skip-cache-clean # Don't clean caches
./build-clean.sh --dev # Development build
./build-clean.sh --extension-only # Build only extension0- Success1- Build failed or verification failed129- Process terminated (e.g., Ctrl+C)
Last Updated: November 10, 2025 Version: 0.10.61 Node Version: 20.10.0