sveltejs / sveltejs/kit

Inconsistent CSS positions for components between the dev and node adapter

Open
#7,426 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

I have global styles in the <svelte:head> for the main +layout.svelte.
On the dev env, the components <styles> put after main <svelte:head> but adapter-node inject it before <svelte:head>. As you can understand, style and behavior depend on order, and some of my rules are not working as I expected.

Reproduction

Compare CSS position for dev and adapter-node relative <svelte:head>.

Logs

No response

System Info
System:
    OS: Linux 5.19 Gentoo Linux
    CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
    Memory: 5.70 GB / 31.26 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.11.0 - /usr/bin/node
    npm: 8.19.2 - /usr/bin/npm
  npmPackages:
    @sveltejs/adapter-node: 1.0.0-next.99 => 1.0.0-next.99 
    @sveltejs/adapter-static: 1.0.0-next.46 => 1.0.0-next.46 
    @sveltejs/kit: 1.0.0-next.526 => 1.0.0-next.526 
    @sveltejs/svelte-virtual-list: github:sveltejs/svelte-virtual-list => 3.0.1 
    svelte: 3.52.0 => 3.52.0 
    vite: ^3.2.1 => 3.2.1
Severity

blocking all usage of SvelteKit

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 main +layout.svelte <svelte:head> styles and the packages/adapter-node entry point. Compare the generated CSS placement relative to <svelte:head> in the dev environment and adapter-node, then verify that both environments use the same ordering.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript, node.js
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.