windicss / windicss-webpack-plugin

🍃 Windi CSS for webpack ⚡
https://windicss.org/integrations/webpack.html
79 stars 19 forks source link

HMR for NextJS failed on windi.config.js change #91

Open donrsh opened 3 years ago

donrsh commented 3 years ago

Describe the bug As title. It seems windi.config.js change doesn't cause HMR on a next.js project.

To Reproduce Steps to reproduce the behavior:

  1. Clone repository: https://github.com/donrsh/issue-NextJS-HMR-on-windi-config-change
  2. Run yarn dev
  3. Visit http://localhost:3000
  4. Modify extend color in windi.config.js (e.g. red: "#f00" -> red: "#0f0")

Expected behavior Observe that the title that consumes text-red (pages/index.js - line15) class didn't change color. Even reload doesn't trigger the update. One needs to rerun the dev server for the change to apply.

Screenshots The color of highlighted texts should change. image

Additional context I work on Windows.

harlan-zw commented 3 years ago

Hey @donrsh

Thanks for the issue and reproduction link!

I took a quick look and unfortunately couldn't replicate the issue. Which means it's either one of two things:

If it's not the first issue then it's a bit tricky for me to debug since I don't have windows. What might help is to run it in debug mode

    "dev": "set DEBUG=windicss-webpack* && next dev",

if set doesn't work, try cross-env

Can you see if you have a line like this

 windicss-webpack-plugin:plugin config dependency at /home/harlan/packages/webpack-windicss-plugin/issue-NextJS-HMR-on-windi-config-change/windi.config.js +60ms

Also can you paste the contents of the debug once you modify the file, if any

donrsh commented 3 years ago

Hi, @harlan-zw, thanks for the help.

By following the instruction, here's the results

  1. There is a line saying the windi.config.js is used: 擷取1

  2. No output to terminal after windi.config.js change. While modifying the page files DOES show some stuff: image