Repository navigation
Replies: 3 comments 3 replies
|
That all makes sense. |
|
Your report is correct, and the probe methodology is the right way to have established it. It is worth stating the underlying reason plainly, because it explains why this is not a bug and why it will not be fixed.
|
|
Yes, the report makes 100% sense and is completely accurate. In v4,
So migrating v3 custom component classes from |
Uh oh!
There was an error while loading. Please reload this page.
From Human
My agent was struggling with frontend for unusually long time until it gets it right.
I asked for a report. Let me know if that even makes sense.
From AI
In v3,
@layer componentswas a Tailwind directive: contents were registered with the engine and purged if unused. In v4 it is emitted as a plain native CSS cascade layer and its contents are always shipped, used or not.@applystill works inside it, so a v3-era stylesheet migrates with no warning and no error — it just silently ships dead CSS.The v4-idiomatic
@utilityis still tree-shaken. Same build, same file:Neither class is referenced by any template. After
vite buildwith@tailwindcss/vite4.3.3:.probe-never-used— present in the output CSSprobe-utility-unused— absentEstablished by grepping the built CSS for each probe, adding and removing them one at a time. The emitted layer order is
properties, theme, base, components, utilities, withcomponentsa real@layer components{...}block in the output.Practical consequences:
@applyinside@layer componentscompiles correctly in v4 — multi-class applies, variants (hover:,focus-visible:,disabled:), and opacity modifiers (bg-primary/85) all expand as expected. If you want a handful of shared widget classes, the v3 pattern is not broken.@layer componentsblock carried over from v3 ships in full. Anyone auditing v4 bundle size should check there first.@utilitygets tree-shaking and participates in variant composition, while@layer componentsgives you plain low-specificity classes that always exist — which is what you want if the class is referenced from somewhere the scanner cannot see (server-rendered markup, string-built class names).All reactions