build: self-host Inter so the build doesn't fetch Google Fonts
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, nextjs, react
- Ambito
- build-system, frontend
Direzione di ricerca
Il font viene caricato con next/font/google in src/app/layout.jsx; Lexend nello stesso file usa già next/font/local, quindi è il pattern da copiare. Committa un Inter .woff2 latin a peso variabile sotto src/fonts/, sostituisci la chiamata a Inter con localFont con le stesse impostazioni display e variable e rimuovi l'import di google. Completato quando npm run build termina con successo senza richieste a fonts.gstatic.com e la variabile --font-inter continua a risolversi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
npm run build downloads the Inter font from Google Fonts on every build, so a network blip on the runner fails the build even when nothing in the source is wrong.
Where: src/app/layout.jsx loads Inter with next/font/google. Next.js fetches the font files from fonts.gstatic.com at build time. Lexend, in the same file, already avoids this by loading a committed file with next/font/local.
Seen in: gofr-dev/gofr's Website Build check (website-pr.yml) on gofr-dev/gofr#4583, run https://github.com/gofr-dev/gofr/actions/runs/41670963807. That PR only changed Go imports and one docs page. The build failed with:
FetchError: request to https://fonts.gstatic.com/s/inter/v20/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa0ZL7W0Q5n-wU.woff2 failed
`next/font` error:
Failed to fetch `Inter` from Google Fonts.
> Build failed because of webpack errors
The same check passed on the previous run of that PR. The stage and prod workflows in gofr-dev/gofr build this site the same way, so a deploy can fail on this too.
Suggested fix: self-host Inter the way Lexend is already self-hosted.
- Commit Inter's variable-weight latin
.woff2(SIL Open Font License) tosrc/fonts/. - In
src/app/layout.jsx, replaceInter({ subsets: ['latin'], display: 'swap', variable: '--font-inter' })withlocalFont({ src: '../fonts/inter.woff2', display: 'swap', variable: '--font-inter' }), and drop thenext/font/googleimport.
The --font-inter CSS variable keeps its name, so no styles change. The build then makes no font requests at all. Visitors already get the font from the site's own origin, because next/font/google self-hosts the downloaded files, so the page itself does not change.
Related: #230 removes another build-time download (the sharp binary) for the same reason.
- Lingua principale
- JavaScript
- Stelle
- 44
- Fork
- 44
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di gofr-dev/website
-
Homepage HTML shows "Trusted by 0+ Developers" to crawlersForse già presa @thzgajendra l’ha presa 38 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Dockerfile builder stage pins node:23.11.1 — a non-LTS line, EOL since 2025-06-01Forse già presa @akshat-kumar-singhal l’ha presa 98 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 54/100
-
Add og:image preview cards to docs pagesForse già presa @adamshatzkamer l’ha presa 36 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 66/100
Tutte le issue di gofr-dev/website
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
githubnext/gh-aw-workshop#5752 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Add: QudsunaTV.psApertachannels:add check:passed
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 66/100
iptv-org/database#39416 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
[TEXT] Flache Karte ist 2DAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
swisstopo/topo-swisseobrowser#48 ·
I maintainer di solito rispondono entro 1 giorno