This repository produces two browser-targeted builds from a single source tree:
- Chrome (Manifest V3) → built into
dist/chrome - Firefox (Manifest V2) → built into
dist/firefox
- Node.js (16+ recommended) and
npm - Install dependencies:
npm ci- Build Chrome output:
npm run build:chromeThe Chrome build uses @crxjs/vite-plugin and writes files to dist/chrome.
- Build Firefox output:
npm run build:firefoxThe Firefox build disables @crxjs (it does not support MV2). It emits deterministic entry files and writes a transformed manifest.json into dist/firefox so the unpacked extension can be loaded in Firefox.
- Create a ZIP for Chrome:
npm run pack:chrome- Create a ZIP for Firefox:
npm run pack:firefoxThe produced ZIP files are placed at the repository root (e.g. bhaikaamdo-extension-chrome.zip).
-
Chrome / Edge:
- Open
chrome://extensions, enable Developer mode → Load unpacked → select thedist/chromedirectory.
- Open
-
Firefox (temporary install):
- Open
about:debugging#/runtime/this-firefox→ "Load Temporary Add-on" → choosedist/firefox/manifest.json.
- Open
- The Firefox build uses Manifest V2 (background scripts) because the current toolchain and target require it; Chrome uses Manifest V3 (service worker). Keep both
src/manifest.chrome.jsonandsrc/manifest.firefox.jsonin sync for metadata and permissions. - Bump the
versionfields insrc/manifest.chrome.jsonandsrc/manifest.firefox.jsonbefore publishing — stores require unique versions. - The build may emit large chunks (warnings about >500 KB). Consider code-splitting or
build.rollupOptions.output.manualChunksto reduce bundle sizes. - If you change content script or background entry filenames in source, verify the Firefox manifest mapping logic in
vite.config.tsstill matches the generated entries.
- Typical CI steps:
npm ci
npm run build:chrome
npm run pack:chrome- For Chrome Web Store automated uploads you will need an OAuth client + refresh token (store as CI secrets) or use a publisher API integration. For Mozilla AMO you can use
web-ext signwith API credentials.
vite.config.ts— per-target build logic and manifest transformsrc/manifest.chrome.json— Chrome (MV3) manifestsrc/manifest.firefox.json— Firefox (MV2) manifest
If you want, I can add a GitHub Actions workflow to build + zip (and optionally upload) using repository secrets. Want me to add that next?