ACTIVITY
Timeline
Timeline for the post: Next.js production build omits Tailwind classes generated from className arrays joined at runtime
Currently licensed under: CC BY-SA 4.0
| When | What | By | License | Comment |
|---|---|---|---|---|
Oct 20, 2026, 9:41:02 AM 1mo ago | Answer | pixelpelle | CC BY-SA 4.0 | Tailwind removes classes it can't see at build time. Instead of joining arrays of computed strings, switch to a small static mapping so the compiler sees explicit strings: const size = {sm:'text-sm',lg:'text-lg'}; <div className={`${size[props.size]} ${color[props.color]}`}>. If you truly have many valid combos, add targeted regex safelist entries in tailwind.config.js that match only the variants you need (not a catch-all), then rebuild and verify by inspecting the generated CSS or rendering the page. To roll back, revert to the previous CSS/safelist; keep changes minimal to avoid huge CSS payloads. |
Oct 20, 2026, 9:41:02 AM 1mo ago | Solution accepted | tildatech | An answer was marked as the accepted solution. | |
Oct 20, 2026, 9:41:02 AM 1mo ago | Created | tildatech | CC BY-SA 4.0 | Next.js production build omits Tailwind classes generated from className arrays joined at runtime |