Skip to content
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

fix(hmr): entry mod's importers contains css mod invalidate hmr #3929

Merged
merged 2 commits into from Jun 28, 2021

Conversation

y1d7ng
Copy link
Contributor

@y1d7ng y1d7ng commented Jun 24, 2021

Description

fix #3913 #3716

HMR is not working as change entry javascript file or index.html

Additional context

entry file main.js:

import './index.css';

index.css:

@tailwind base;

hmr is not working as change themain.js, the client receive the error update message - hmr update index.css

PostCSS plugin Tailwind JIT register any file as a dependency to a CSS file. Although main.js is an entry file, main.js module's importers includes index.css module. Through the propagateUpdate function, get the wrong result that index.css needs to be updated.

function propagateUpdate(


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@yyx990803
Copy link
Member

Thanks @OneNail - the fix is correct, but the way it is implemented can be a bit difficult to read for future maintainers. I refactored it to be more explicit what case it is handling.

@patak-dev patak-dev merged commit d97b33a into vitejs:main Jun 28, 2021
@y1d7ng y1d7ng deleted the hotfix-hmr branch June 28, 2021 14:38
aleclarson pushed a commit to aleclarson/vite that referenced this pull request Nov 8, 2021
…js#3929)

* fix(hmr): entry mod's importers contains css mod invalidate hmr

* Update hmr.ts

Co-authored-by: Evan You <yyx990803@gmail.com>
@fabio-ivona
Copy link

fabio-ivona commented Aug 2, 2022

@yyx990803

If I've well understood the related issues, it seems that this fix aims to full reload the page when a tailwindcss app.css change is triggered by a change in an html file (or similar)

this works well quite all the times, but our plugin for livewire hot reload is broken by this (because it triggers a full reload while the client part of the plugin is trying to refresh the single livewire component)

is there any way to make this feature opt-in? or will you accept a PR to allowe to disable this in config

there are cases where a full reload is not needed (if not detrimental) when app.css is updated by tailwind

for reference:

https://github.com/def-studio/vite-livewire-plugin/discussions/12
laravel/vite-plugin#111

@Niputi
Copy link
Contributor

Niputi commented Aug 2, 2022

@fabio-ivona please open a new issue

@fabio-ivona
Copy link

@Niputi thanks for your repy!

done in #9512

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vite Hot Reload not working
5 participants