question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HMR doesn't work in freshly installed Vite Vanilla-Extract React App

See original GitHub issue

Describe the bug

HMR doesn’t work in a newly installed App with React, Vanilla-Extract and Vite. All packages are on the newest version. Instead the page reloads and React loses its State whenever Test.css.ts is safed. yarn create vite vite-vanilla-extract-test --template react-ts No error messages were displayed (vite: logLevel: “error”, vanillaExtractPlugin identifiers:debug).

Link to reproduction

Link

System Info

Output of npx envinfo --system --npmPackages @vanilla-extract/css,@vanilla-extract/webpack-plugin,@vanilla-extract/esbuild-plugin,@vanilla-extract/vite-plugin,@vanilla-extract/sprinkles,webpack,esbuild,vite --binaries --browsers: System: OS: Windows 10 10.0.19044 CPU: (8) x64 Intel® Core™ i7-8550U CPU @ 1.80GHz Memory: 5.70 GB / 15.57 GB Binaries: Node: 14.18.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.17 - C:\Program Files\nodejs\yarn.CMD npm: 6.14.15 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.19041.1266.0), Chromium (98.0.1108.43) npmPackages: @vanilla-extract/css: ^1.6.8 => 1.6.8 @vanilla-extract/vite-plugin: ^3.1.2 => 3.1.2 vite: ^2.8.0 => 2.8.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
tamanugicommented, Jun 6, 2022
3reactions
drywolfcommented, Mar 12, 2022

I found a workaround by forcing the vite-plugin to a specific older version, calling: yarn add @vanilla-extract/vite-plugin@2.1.3

and in the vite.config.ts using: vanillaExtractPlugin({devStyleRuntime: "vanilla-extract"})

(this option for the plugin is only available in the older version, versions >= 3.0.0 had this option removed)

So this issue might still be related to #346 #422

Read more comments on GitHub >

github_iconTop Results From Across the Web

HMR doesn't work in freshly installed Vite Vanilla-Extract ...
Describe the bug HMR doesn't work in a newly installed App with React, Vanilla-Extract and Vite. All packages are on the newest version....
Read more >
vanilla-extract-webpack-react
seek-oss/vanilla-extract. This Sandbox is in sync with master on GitHub. You have to fork to make changes. Fork. Files. src. App.css.ts. App.tsx.
Read more >
Adding Vite to Your Existing Web App
Hot module reloading (HMR)​​ Now that the development server is running, try modifying your source code. The output should update almost ...
Read more >
Vite React TypeScript monorepo hot module reloading ...
I'm having trouble getting HMR working when running vite dev . The example repo is here: https://github.com/jakeboone02/em-hmr-test. If you run ...
Read more >
refresh page without reload vuejs
Open side panel. How to update data on a page without refreshing on the vue.js? ... Try changing code in AppComponent and see...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found