sveltejs / sveltejs/kit

Vite's static asset handling from `app.html`

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

Nobody has claimed this yet.

pkg:adapter-static
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

When loading the fallback page, a blank white page is shown until the JS loads my stylesheet. This is very annoying if I am using a dark background-color, because the page flashes from the blank white page to my dark background color.

Because the stylesheet is imported in my root +layout.svelte, I expect SvelteKit to include it in the head element, but it doesn't.

Related: #1948

Reproduction

https://github.com/GitRowin/svelte-kit-fallback-flash

Logs

No response

System Info
System:
    OS: Windows 10 10.0.22621
    CPU: (12) x64 AMD Ryzen 5 2600X Six-Core Processor
    Memory: 8.46 GB / 15.94 GB
  Binaries:
    Node: 20.0.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 3.5.0 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 9.4.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.1702.0), Chromium (113.0.1774.50)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @sveltejs/adapter-auto: ^2.1.0 => 2.1.0
    @sveltejs/adapter-static: ^2.0.2 => 2.0.2
    @sveltejs/kit: ^1.18.0 => 1.18.0
    svelte: ^3.59.1 => 3.59.1
    vite: ^4.3.8 => 4.3.8
Severity

annoyance

Additional Information

No response

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

Start with the linked reproduction and inspect app.html alongside the root +layout.svelte stylesheet import. Reproduce the fallback-page flash and trace when the stylesheet reaches the head. Done means the stylesheet is available before JavaScript loads, avoiding the blank white flash.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, vite
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.