Skip to content

[Bug?]: Global Sass styles duplicated multiple times in DEV mode (SolidStart vs Solid SPA behavior) #2137

@marbrex

Description

@marbrex

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

After migrating from a SolidJS SPA (Vite + Solid) to SolidStart, global styles imported via Sass are being duplicated multiple times in development mode (in my case, every rule gets duplicated 4 times).

This behavior did not occur in the previous setup (Vite + Solid SPA), where the same Sass import resulted in a single stylesheet being injected.

Expected behavior 🤔

  • Global CSS imported once should be injected only once
  • Behavior should be consistent with SolidJS SPA (Vite + Solid)

Steps to reproduce 🕹

Steps:

  1. Create a SolidStart app with Yarn PnP (Here is my package.json)
  2. Write some Sass
  3. Import a global .scss file once in app.tsx (import "~/scss/main.scss")
  4. Run yarn dev
  5. Open DevTools, you’ll see the same styles injected multiple times

Context 🔦

This issue has several practical consequences :

  • Makes debugging styles harder
  • Breaks expectations when migrating from Solid SPA to SolidStart
  • Forces reconsideration of the entire styling architecture

In order to work around the issue, I tried to migrate to CSS Modules. While it seems to avoid the issue, it requires a large-scale refactoring of my entire codebase, so it's very expensive. So I would like to keep my current architecture with global styles.

Your environment 🌎

- OS: Ubuntu 22.04.1 x86_64
- Node: v20.18.1
- Yarn: 4.12.0 (PnP + Zero-Installs)
- "@solidjs/start": "^1.3.2"
- "@solidjs/router": "^0.16.1"
- "solid-js": "^1.9.12"
- "vinxi": "^0.5.11"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions