signals icon indicating copy to clipboard operation
signals copied to clipboard

Vite HMR not working

Open MichaelGradek opened this issue 3 years ago • 2 comments

HMR is not triggered on file changes when using @preact/signals-react

Vite does seem to detect the code changed as the console line keeping count of changes does increase:

8:27:13 PM [vite] hmr update /src/App.tsx (x35)

However, the changes in code / UI do not get updated.

As soon as I switch back to react's useState it starts working again.

package.json

{
  "name": "test",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "tsc && vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "@preact/signals-react": "^1.2.2",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@types/react": "^18.0.28",
    "@types/react-dom": "^18.0.11",
    "@vitejs/plugin-react-swc": "^3.0.0",
    "typescript": "^4.9.3",
    "vite": "^4.2.0"
  }
}

MichaelGradek avatar Apr 01 '23 18:04 MichaelGradek

Happens with webpack HMR as well

pupudu avatar Apr 04 '23 11:04 pupudu

Duplicate of #250

rschristian avatar Apr 05 '23 22:04 rschristian