Giter Site home page Giter Site logo

Comments (7)

hansoksendahl avatar hansoksendahl commented on July 26, 2024

I am seeing this same issue, introduced a little over a week ago.

from solid-start.

hansoksendahl avatar hansoksendahl commented on July 26, 2024

Minimial reproduction repository

from solid-start.

ryansolid avatar ryansolid commented on July 26, 2024

@hansoksendahl do you know the last version where it was working? That would help me narrow it down considerably.

from solid-start.

edivados avatar edivados commented on July 26, 2024

This is a vinxi issue right? Vinxi sends the hmr update to replace the css, classes don't match anymore, styling disappears and reload is required.

No sure if there is a way around a reload but here is where to look I think. Maybe sending a full-reload for css modules?
https://github.com/nksaraf/vinxi/blob/4bddafe1b7e873ef691392ebaf7ea4f4875e39d4/packages/vinxi/lib/plugins/css.js#L15

Edit: Oh... it looks to me as if the return value (empty array) is the problem causing vite to only send the custom event. I will make a PR later.

from solid-start.

The0inkinator avatar The0inkinator commented on July 26, 2024

This issue is persisting for me still is there an update on what is going on with this? @edivados Thanks in advance

from solid-start.

FlatMapIO avatar FlatMapIO commented on July 26, 2024

Downgrading vinxi to 3.10 should temporarily avoid this issue?

from solid-start.

froggydood avatar froggydood commented on July 26, 2024

A not so nice temporary fix for this is to customize the class name generator vite uses in the config to only use the file path and class name and ignore the css contents when generating class names. This means that class names don't change when the contents changes, which I believe is whats causing the issues.

Example config.

import crypto from "crypto"

export default defineConfig({
  ssr: true,
  vite: {
    css: {
      modules: {
        // Need to generate css module names based on only the file path and class name
        // because the dev reloading doesn't work well when classes change when css contents change.
        generateScopedName(name, filename, css) {
          const hasher = crypto.createHash("sha256")
          hasher.update(name + filename)
          const hash = hasher.digest().toString("hex");
          return `${name}__${hash.substring(0, 16)}`
        },
      }
    }
  }
});

There is one problem with this though, it doesn't fix the issue of you adding a new class in the css, as it goes from an empty string to some value and therefore that still requires a page refresh.

from solid-start.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.