Skip to content

feat: replace Next.js options page with a bun-bundled SPA#63

Closed
erikbrinkman wants to merge 1 commit into
mainfrom
pr63
Closed

feat: replace Next.js options page with a bun-bundled SPA#63
erikbrinkman wants to merge 1 commit into
mainfrom
pr63

Conversation

@erikbrinkman

Copy link
Copy Markdown
Contributor

The options page was the only remaining use of Next.js. Its Pages-Router
static export loaded under MV3's script-src 'self' CSP only because
every script was an external self-hosted file; the App Router emits
inline RSC bootstrap scripts the CSP rejects, so there was no path to
modernizing onto it.

Drop Next.js entirely and build the page with bun build, like the
other entry points. options.html is the single source of truth: it
references src/options-main.tsx directly, so bun dev serves it with
HMR and bun build ./options.html derives the production out/ (hashed
JS/CSS/SVG/favicon + rewritten HTML). The result has no chunks and no
inline scripts.

  • pages/index.tsx -> components/options-page.tsx, mounted by
    src/options-main.tsx via createRoot
  • next/font/google -> @fontsource (woff2 inlined as data URIs by bun)
  • next/head -> options.html shell; next/image / StaticImage ->
    with the logo imported through the bundler as a hashed asset
  • pack zips the self-contained out/ dir instead of a hand-listed glob
  • remove next, @next/eslint-plugin-next, next.config.js, pages/,
    styles.css, the assetPrefix "/out" hack and stale tsconfig entries
  • drop 28 dead eslint-disable comments (no eslint is configured)

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

The options page was the only remaining use of Next.js. Its Pages-Router
static export loaded under MV3's `script-src 'self'` CSP only because
every script was an external self-hosted file; the App Router emits
inline RSC bootstrap scripts the CSP rejects, so there was no path to
modernizing onto it.

Drop Next.js entirely and build the page with `bun build`, like the
other entry points. `options.html` is the single source of truth: it
references `src/options-main.tsx` directly, so `bun dev` serves it with
HMR and `bun build ./options.html` derives the production `out/` (hashed
JS/CSS/SVG/favicon + rewritten HTML). The result has no chunks and no
inline scripts.

- pages/index.tsx -> components/options-page.tsx, mounted by
  src/options-main.tsx via createRoot
- next/font/google -> @fontsource (woff2 inlined as data URIs by bun)
- next/head -> options.html shell; next/image / StaticImage -> <img>
  with the logo imported through the bundler as a hashed asset
- pack zips the self-contained out/ dir instead of a hand-listed glob
- remove next, @next/eslint-plugin-next, next.config.js, pages/,
  styles.css, the assetPrefix "/out" hack and stale tsconfig entries
- drop 28 dead eslint-disable comments (no eslint is configured)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant