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.

Vite + Tailwind automatic full page reload

See original GitHub issue

Describe the bug

I’m not sure if this is a bug with Vite or Tailwind, but it looks similar to #4147, #4267 and #4150. The difference is that this “bug” actually works too good (which is a weird thing to say I know).

HMR works perfectly as it should, but when altering files that Tailwind lists in its purge list in the Tailwind config, the browser reloads automatically. This shouldn’t be happening. Normally, we use the ViteRestart plugin to tell Vite it needs to watch some files that are not JS, and if they change it should reload the browser.

But as I read in the linked git issues, this is because Tailwind adds them as dependencies and Vite picks them up. This should be fixed in 2.4.3 but not the issue I have.

Reproduction

I think it is clear.

System Info

System:
    OS: macOS 11.6
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 372.11 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.22.7 - /usr/local/opt/node@12/bin/node
    npm: 6.14.15 - /usr/local/opt/node@12/bin/npm
  Browsers:
    Chrome: 96.0.4664.55
    Edge: 95.0.1020.53
    Firefox: 92.0.1
    Firefox Developer Edition: 95.0
    Safari: 15.0
  npmPackages:
    @vitejs/plugin-legacy: ^1.6.3 => 1.6.3 
    vite: ^2.6.14 => 2.6.14

Used Package Manager

npm

Logs

No response

Validations

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
gonecommented, Feb 11, 2022

Downgrading didn’t prevent this for me

1reaction
nvthuong1996commented, Dec 8, 2021

downgrade vite to version 2.6.1 to resolve this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

vite is not auto reloading index.html on save after tailwind ...
I have installed Vite with Tailwind. But after installing Tailwind , when I change the index.html file, the Vite server does not auto...
Read more >
HMR API - Vite
'vite:beforeFullReload' when a full reload is about to occur; 'vite:beforePrune' when modules that are no longer needed are about to be pruned; 'vite:invalidate ......
Read more >
Usage - Laravel Vite
Vite integration for the Laravel framework. ... is enabled: editing a Blade file will trigger a full-page refresh, but editing assets which Vite...
Read more >
Fixing Hot Module Reload of Vite App in WSL - YouTube
Is hot reloading not working in your app created with Vite ? For Windows and WSL users polling might the solution to your...
Read more >
Recommended Plugins | Vite Ruby
env in the client code is not an option. Full Reload #. Use vite-plugin-full-reload to automatically reload the page when making changes to...
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