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

Vite + Tailwind JIT -> broken HMR #4147

Closed
6 tasks done
jods4 opened this issue Jul 6, 2021 · 11 comments
Closed
6 tasks done

Vite + Tailwind JIT -> broken HMR #4147

jods4 opened this issue Jul 6, 2021 · 11 comments

Comments

@jods4
Copy link
Contributor

jods4 commented Jul 6, 2021

Describe the bug

When I add Tailwind (JIT mode) to my PostCSS config, HMR doesn't kick-in for Vue templates anymore.

Reproduction

Without tailwindcss in my .postcssrc.json:
kCHu4zilUb
Notice the hmr update home.vue appearing in terminal (and it works in browser).

Now let's add Tailwind to .postcssrc.json:

{
  "plugins": {
    "tailwindcss": {}
  }
}

Note that I'm using JIT mode, in tailwind.config.js:

module.exports = {
  mode: "jit",
  purge: ["./{Components,Modules}/**/*.vue", "./app.vue"],
}

Restart, it works. Let's try hmr again:
MWmzJ89hDo

As you can see, only index.css was HMR.
This is semi-expected as Tailwind JIT watches template changes and dynamically create required styles (although I did not create any new style in this edit -- but it could be the case).
The home.vue template HMR is nowhere to be seen, though; it didn't update in browser, of course.

System Info

System:
    OS: Windows 10 10.0.18363
    CPU: (12) x64 Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz
    Memory: 6.30 GB / 15.79 GB
  Binaries:
    Node: 15.5.1 - C:\Program Files\nodejs\node.EXE
    npm: 7.3.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.18362.1593.0)
    Internet Explorer: 11.0.18362.1
  npmPackages:
    @vitejs/plugin-vue: ^1.2.4 => 1.2.4 
    vite: ^2.4.0 => 2.4.0 

Used Package Manager

npm

Logs

No response

Validations

@patak-dev
Copy link
Member

Hey @jods4, we just merged #4127 and it will be part of 2.4.1 (to be released soon). Would you try if this issue is not present against main? Thanks!

@jods4
Copy link
Contributor Author

jods4 commented Jul 6, 2021

Yes, I can gladly test it!
What's the best way to grab it?

@patak-dev
Copy link
Member

What's the best way to grab it?

https://vitejs.dev/guide/#using-unreleased-commits

@patak-dev
Copy link
Member

@jods4 vite@2.4.1 has been released, so you can directly test this by updating to it

@jods4
Copy link
Contributor Author

jods4 commented Jul 6, 2021

ah thanks, fitting.
I was trying with a local build but had problems (__DEFINES__ is not defined in vite client)

@jods4
Copy link
Contributor Author

jods4 commented Jul 6, 2021

@patak-js not quite fixed.
In 2.4.1 modifying templates triggers a full page reload, not hmr.

@patak-dev
Copy link
Member

@OneNail would you take a look at this one?

@y1d7ng
Copy link
Contributor

y1d7ng commented Jul 6, 2021

@OneNail would you take a look at this one?

I can't reproduce this, hmr works fine when I use tailwind and vue together, @jods4 can you provide a small repro, thanks

@jods4
Copy link
Contributor Author

jods4 commented Jul 6, 2021

😣
Ok I just tried to put up a minimal repro but it seems to work for me as well...
There must be something more in my project, but it's a large project... oh well let me try to isolate what triggers the issue.

@patak-dev
Copy link
Member

@jods4 I'll close this one, please open a new issue with the reproduction. Thanks!

@jods4
Copy link
Contributor Author

jods4 commented Jul 6, 2021

See #4150. I was lucky, the 1st thing I tried to bring in triggered the issue.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants