+error.svelte css import bleeds into normal layout
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the bug
within the +error.svelte, I have an import "error.css".
This error.css gets loaded on any normal page, regardless of the route. It seems to ALWAYS get injected.
The same even happens when i use a component within the +error.svelte and import it (i.e. i create a ErrorPage.svelte and use that within +error.svelte.
Even more annoyingly it gets loaded after the +layout.svelte's import 'main.css' .
Reproduction
Logs
System Info
System:
OS: Linux 6.11 TUXEDO OS 24.04.1 LTS
CPU: (16) x64 AMD Ryzen 7 8845HS w/ Radeon 780M Graphics
Memory: 37.31 GB / 60.62 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 22.15.0 - /usr/bin/node
npm: 10.9.2 - /usr/bin/npm
pnpm: 9.15.0 - /usr/bin/pnpm
Browsers:
Brave Browser: 135.1.77.101
npmPackages:
@sveltejs/adapter-node: ^5.2.12 => 5.2.12
@sveltejs/kit: ^2.20.7 => 2.20.7
@sveltejs/vite-plugin-svelte: ^5.0.3 => 5.0.3
svelte: ^5.27.3 => 5.27.3
vite: ^6.3.2 => 6.3.2
Severity
serious, but I can work around it
Additional Information
Thanks. Seriously thanks for svelte and svelteKit and all of it. cheers
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked StackBlitz reproduction, especially src/routes/+page.svelte, then inspect the referenced +error.svelte and +layout.svelte imports for error.css and main.css. Reproduce the normal-page load and compare stylesheet injection order; done means error.css is loaded only for the error route and does not override the normal layout stylesheet.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100