vanilla-extract icon indicating copy to clipboard operation
vanilla-extract copied to clipboard

Nuxt3 + vanilla extract, issue with HMR when SSR is enabled

Open Hecatron opened this issue 2 years ago • 4 comments

Describe the bug

I've recently had another look at using vanilla extract for use with Nuxt3. It appears mostly fine although it looks as if HMR doesn't work if SSR is enabled for the site

I've noticed that vite / nuxt is detecting a change and reloading the page but it's just not showing up even with a full manual page refresh. Disabling SSR across the entire nuxt app seems to work, but prevents it from being used with themes such as docus. I've tested this on both Windows 10 and a Rpi running raspian and the results are the same so I don't think it's an issue unique to windows pathing.

Reproduction

https://github.com/Hecatron-Forks/vanilla-extract-example

System Info

windows:

  System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
    Memory: 2.27 GB / 15.68 GB
  Binaries:
    Node: 19.8.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 9.1.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (114.0.1823.41)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @vanilla-extract/css: ^1.11.1 => 1.11.1
    @vanilla-extract/vite-plugin: ^3.8.2 => 3.8.2

Rpi / Raspian:

System:
    OS: Linux 6.1 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (4) arm64 Cortex-A72
    Memory: 7.20 GB / 7.63 GB
    Container: Yes
    Shell: 5.1.4 - /bin/bash
  Binaries:
    Node: 20.0.0 - /usr/local/bin/node
    npm: 9.6.4 - /usr/local/bin/npm
  Browsers:
    Firefox: 102.12.0esr
  npmPackages:
    @vanilla-extract/css: ^1.11.1 => 1.11.1
    @vanilla-extract/vite-plugin: ^3.8.2 => 3.8.2

Used Package Manager

pnpm

Logs

I'm not seeing any errors in the console

Validations

Hecatron avatar Jun 09 '23 15:06 Hecatron

I've also tried the emitCssInSsr: true option but that doesn't seem to help It'll only refresh if nuxt does a full on reload of the development server (such as when editing the nuxt.config.ts)

Hecatron avatar Jun 09 '23 17:06 Hecatron

I can reproduce this issue. And setting ssr: false indeed makes it work. @mattcompiles @markdalgleish any ideas? Could this be a Vite plugin issue? Or more likely to be a Nuxt issue?

graup avatar Jul 04 '23 10:07 graup

Thought this might have been fixed by the latest version of the vite plugin (4.0.4 at time or writing), but it's still showing the same issue :(

askoufis avatar Mar 02 '24 02:03 askoufis