sveltejs / sveltejs/kit

preload fonts by default

Open
#10,596 4 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-decision
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

According to https://github.com/sveltejs/kit/pull/4963, @Rich-Harris said we don't preload fonts by default because they may be imported but not used on a page. Though I'm not sure that's a great reason for us to not do it by default as that seems like the user has coded things incorrectly in that case

Describe the proposed solution

Maybe Vite could issue a warning for fonts that are imported, but never used if we really care about detecting that

Alternatives considered

No response

Importance

nice to have

Additional Information

Font preloading sometimes doesn't work before Vite 5. Fixed in https://github.com/vitejs/vite/pull/14297

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by reading SvelteKit's font asset handling and the referenced Vite pull requests, then determine where the default preload behavior is configured. Done means the agreed default behavior is implemented and covered by tests for imported fonts that are used on a page.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, vite
Domain
performance, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.