-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disabling HMR Prevents Tailwind from Updating #10270
Labels
Comments
I hit the same issue, using the latest version of vite (4.0.3) and the latest tailwind (3.2.4). Here's my workaround:
UPDATE: A much better workaround (that doesn't require running vite in build mode):
const wss = new WebSocketServer({port: 0}); // 0 means find a free port
server: {
hmr: {
clientPort: (wss.address() as AddressInfo).port
}
} This creates a no-op websocket server and tells the client to talk to it instead of vite's server, effectively disabling any hmr updates. |
russelldavis
added a commit
to russelldavis/vite
that referenced
this issue
Dec 27, 2022
russelldavis
added a commit
to russelldavis/vite
that referenced
this issue
Dec 27, 2022
In the non-hmr path, when invalidating a module, it wasn't invalidating the importers. This meant that CSS dynamically generated based on a module's contents (e.g., what tailwind does) would not regenerate when refreshing a page. The HMR code path already invalidated importers, which is why the bug didn't exist with HMR enabled. This change makes the invalidation consistent between HMR and non-HMR.
russelldavis
added a commit
to russelldavis/vite
that referenced
this issue
Dec 27, 2022
In the non-hmr path, when invalidating a module, it wasn't invalidating the importers. This meant that CSS dynamically generated based on a module's contents (e.g., what tailwind does) would not regenerate when refreshing a page. The HMR code path already invalidated importers, which is why the bug didn't exist with HMR enabled. This change makes the invalidation consistent between HMR and non-HMR.
russelldavis
added a commit
to russelldavis/vite
that referenced
this issue
Dec 27, 2022
In the non-hmr path, when invalidating a module, it wasn't invalidating the importers. This meant that CSS dynamically generated based on a module's contents (e.g., what tailwind does) would not regenerate when refreshing a page. The HMR code path already invalidated importers, which is why the bug didn't exist with HMR enabled. This change makes the invalidation consistent between HMR and non-HMR.
9 tasks
I submitted a PR that fixes this: #11506 |
sapphi-red
added
feat: hmr
p3-minor-bug
An edge case that only affects very specific usage (priority)
has pr
and removed
pending triage
labels
Dec 31, 2022
patak-dev
pushed a commit
that referenced
this issue
Jan 4, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Describe the bug
I disabled HMR because it causes every tab to reload, whereas what I need is that only 1 tab to be reloaded while others stay put for me to compare the style changes visually.
By setting
server.hmr
to false, it does what I want, to stop HMR. But on a manual refresh in the browser, the Tailwind styles don't get updated. As if the JIT engine doesn't get re-ran.I've discussed this not in Vite's Discord but Laravel's. But I don't think this is such a specific issue.
Link to the post here: https://discord.com/channels/297040613688475649/1024554528734969857
In the reproduction link below:
text-red-500
with any other style, such astext-yellow-500
ortext-2xl
etc.index.html
) and manually hit reload.Reproduction
https://stackblitz.com/edit/vitejs-vite-wwtrrb?file=index.html&terminal=dev
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: