css went from 42kb to 188kb after the v4 upgrade and i cannot find why Tailwind v4
Same app, same components, upgraded from v3 to v4 and the emitted stylesheet more than quadrupled. Nothing about the UI changed.
I have read the output and there are thousands of utilities in there that no component of mine uses. Some of them are arbitrary values with hex colours I have never typed. I do not have a content array to look at any more, so I do not know where to start narrowing this down.
@burr_bennet · last mo. · 2 replies
v4 detects sources automatically from the stylesheet's project root and respects
.gitignore. Two ways that goes wrong:One, your build output directory is not actually gitignored, or you added an explicit
@sourcethat reaches it. Now it scans your previous build, and every class string that has ever existed in that project comes back from the dead. This is the common one and it explains "hex colours I never typed", because they were in a build from four months ago.Two, some directory of content - markdown, JSON fixtures, a vendored file - contains words that happen to parse as candidate utilities.
Fix is to stop relying on detection. Narrow it with explicit
@sourcerules for the directories you actually author in, and carve out the offender with a@source notrule. Then diff the output again and it should drop back.Reply
Report
@lowell_frame · last mo.
Check your exact v4 minor before you write
@source not, it was not there from the first release. If it parses as an error that is what happened and you have not typed it wrong.Reply
Report