feat: Added support for Gecko (firefox) - #7
Conversation
james-yap
left a comment
There was a problem hiding this comment.
✅ Code review completed. Changes look solid — clean architecture for multi-browser support.
james-yap
left a comment
There was a problem hiding this comment.
Found several issues that need addressing before merge. See inline comments.
Code Review — feat: Added support for Gecko (Firefox)Verdict: COMMENT (no hard blockers, but a few things worth addressing before merge) ✅ What's Great
|
| @@ -1,17 +1,19 @@ | |||
| import { clsx, type ClassValue } from "clsx" | |||
| import { twMerge } from "tailwind-merge" | |||
| // [FIX] Tell TypeScript that 'browser' is a valid global variable | |||
There was a problem hiding this comment.
declare const browser: any bypasses the polyfill's type definitions. Since browser is already imported from webextension-polyfill in other files, this ambient declaration is not needed. The typeof browser !== 'undefined' runtime guard below works fine without it — just remove this line. If you need the types here, import them from webextension-polyfill directly.
| }, | ||
| "browser_specific_settings": { | ||
| "gecko": { | ||
| "id": "openbanker@voidranjer", |
There was a problem hiding this comment.
💡 Trailing space after the extension ID string — minor nit, worth cleaning up.
- Remove ambient declare const browser in utils.ts; use (globalThis as any).browser?.runtime?.id instead - Add dev:firefox script to package.json - Remove trailing space in manifest.firefox.json - Add shallow-merge warning comment in vite.config.ts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks for the detailed review! Addressed all the points:
|
There was a problem hiding this comment.
Pull request overview
This PR aims to add Firefox (Gecko) support for the browser extension by moving the frontend code to webextension-polyfill APIs and introducing per-browser manifest/build outputs in the extension package.
Changes:
- Switched frontend extension interactions (storage/tabs/scripting) to
webextension-polyfilland updated extension-context detection. - Added per-target build outputs (
dist/chrome,dist/firefox) and build scripts to generate a mergedmanifest.jsonper target. - Introduced
manifest.base.jsonplus browser-specific manifest overrides for Chrome and Firefox.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/frontend/src/lib/utils.ts | Update extension-context detection to include Firefox (browser.*). |
| packages/frontend/src/hooks/useChromeStorage.ts | Replace callback-style chrome.storage usage with promise-based webextension-polyfill storage. |
| packages/frontend/src/App.tsx | Use webextension-polyfill for tabs.query and scripting.executeScript; add Transaction casting. |
| packages/frontend/package.json | Add webextension-polyfill + types. |
| packages/chrome/vite.config.ts | Add manifest merging + per-target output directories + manifest generation plugin. |
| packages/chrome/scripts/copy-frontend.js | Copy frontend build into per-target extension dist directory. |
| packages/chrome/package.json | Add TARGET-based dev/build scripts; add polyfill deps. |
| packages/chrome/manifest.base.json | Split shared manifest configuration into a base manifest. |
| packages/chrome/manifest.chrome.json | Chrome MV3 background service worker override. |
| packages/chrome/manifest.firefox.json | Firefox-specific manifest override (background + Gecko settings). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1,42 +1,62 @@ | |||
| import { defineConfig } from "vite"; | |||
| import { resolve } from "path"; | |||
| import fs from "fs"; | |||
There was a problem hiding this comment.
Fixed — changed to import * as fs from "node:fs" in vite.config.ts.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
No description provided.