Editing 11ty config breaks tailwindcss vite plugin
I recorded a pretty quick loom (hopefully this is helpful) https://www.loom.com/share/4a73e50bbef444d1bd216d98e3771e8b
Project is viewable on GitHub here (if helpful) https://github.com/kitajchuk/missjennysschool
Details:
- I'm using the latest version of tailwindcss v4 with their vite plugin
- I'm on 11ty v3
- I'm on 6.0.0-alpha.4 of this plugin
Problem:
Whenever I edit the 11ty config file (or any file imported there) the vite tailwindcss plugin stops working, or breaks. Specifically in the browser I begin getting 404s on the tailwindcss file (in loom).
I have to restart the 11ty dev server to resolve this. Editing templates, CSS and even JavaScript data files all work fine and don't break the plugin. There are no issues building as I have this deployed on Netlify and it works great.
My 11ty config:
https://github.com/kitajchuk/missjennysschool/blob/760b88f2f43b89bc534c081b77010ba067c6b965/eleventy.config.js#L13-L17
Thanks for the detailed report, I can reproduce your problem! To be honest I currently have no clue, where to look at. Any help is highly appreciated.
Thanks! Reproducibility is nice. I'm not entirely sure either—I've never worked on an 11ty plugin before.
The exact output (in isolation) when I save the 11ty config file while the dev server is running is this:
[11ty] File changed: eleventy.config.js
[11ty] Writing ./_site/index.html from ./web/index.html (liquid)
[11ty] Copied 9 Wrote 1 file in 0.04 seconds (v3.0.0)
[11ty] Watching…
[11ty] Server at http://localhost:8080/
1:13:32 PM [vite] (client) hmr update /css/styles.css?direct
1:13:32 PM [vite] (client) page reload index.html
Vite is just referencing /css/styles.css which makes it unclear whether it's looking at the source or the dist in _site. My assumption was that it would look at the source and handle processing and output to the _site dist.
I do have 11ty using passthrough on the CSS:
eleventyConfig.addPassthroughCopy({ "web/css": "css" });
I'm not sure if this is an issue—maybe there is a conflict between Vite/11ty trying to hold/manage a reference to the output file?
I'll toy around with it some more and see if I can't figure anything more useful out 🤔.
Can confirm I'm having exactly the same problem.