Open chiragparekh opened 2 months ago
I’m experiencing a similar issue where Tailwind CSS classes do not update with HMR unless I reload the site. However, if I add a class that has already been used elsewhere in the application, it updates correctly with HMR.
Interestingly, this issue resolves when I disable the Shadow DOM by setting disableShadowDOM: true
. However, this workaround defeats the purpose of using the Shadow DOM in my project.
@MohamedKamalOthman I have tried with disableShadowDOM: true
but it didn't work for me. My idea was to conditionally toggle value for that attribute like if its in development mode then disable Shadow Dom but unfortunately it didn't work for me.
The HMR cannot update the module directly with the shadow DOM; therefore, I would suggest using a workaround solution add this custom plugin to the plugins array of vite config file
plugins: [
// ... other plugins ...
{
name: 'force-reload',
handleHotUpdate({ file, server }) {
// Force full page reload for all .vue file changes
if (file.endsWith('.vue')) {
server.ws.send({ type: 'full-reload' })
return []
}
},
},
],
@EranGrin Thanks for now I have used the code that you have provided for full page reload.
Hi I am using this library with shadow root and HMR is working but tailwind styles are not updating.
This is the
main.js
fileThis is the
index.scss
fileThis is the vite config file