Skip to content

HTML duplication across extension shells (Chrome + Firefox + shared) #33

@paperhurts

Description

@paperhurts

Three copies of popup.html and options.html exist in the repo today:

  • packages/extension-shared/src/popup.html (canonical)
  • packages/extension-chrome/src/popup.html (Vite entry for the Chrome shell)
  • packages/extension-firefox/src/popup.html (Vite entry for the Firefox shell)

Same for options.html. Identical content; updating one and forgetting the others silently drifts.

Why three copies

Vite needs HTML as a build entry. The shells' vite.config.ts files point at their own src/*.html, so the files must physically exist in each shell. We can't currently reach into the workspace dep's HTML via a Vite entry path.

Options

  1. Pre-build script in each shell that copies from @gitmarks/extension-shared/src/*.html → its own src/*.html before vite build runs. Authoritative source stays in the shared package; the copies become build artifacts (gitignored).
  2. Point Vite entries at node_modules/@gitmarks/extension-shared/src/popup.html directly (works in pnpm because of workspace symlinks, but breaks if anyone materializes deps without symlinks).
  3. Templated HTML — generate the file at build time from a TS module in extension-shared.

(1) is the lowest-friction. Probably a 30-line script per shell.

Flagged by

Post-merge code review of PR #32.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions