feat: replace Next.js options page with a bun-bundled SPA#64
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 becauseevery 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 theother entry points.
options.htmlis the single source of truth: itreferences
src/options-main.tsxdirectly, sobun devserves it withHMR and
bun build ./options.htmlderives the productionout/(hashedJS/CSS/SVG/favicon + rewritten HTML). The result has no chunks and no
inline scripts.
src/options-main.tsx via createRoot
with the logo imported through the bundler as a hashed asset
styles.css, the assetPrefix "/out" hack and stale tsconfig entries
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com