Skip to content

Conversation

@benceruleanlu
Copy link
Member

@benceruleanlu benceruleanlu commented Aug 28, 2025

Summary

Upgrades tailwindcss from 3.4.4 to 3.4.17 to fix a critical build error that occurs with Node.js 22.12+ and 23.x:

ERROR [vite] Internal server error: [postcss] Cannot read
properties of undefined (reading 'call')
  File: /frontend/src/assets/css/style.css:undefined:NaN
      at /frontend/tailwind.config.js:226:39

Root Cause Analysis

The Bug Chain

  1. Node.js 22.12 introduced native require(esm) support
    module: unflag --experimental-require-module nodejs/node#55085

    • Allows CommonJS to directly require ESM modules without experimental flag
  2. Our commit 7d6e252 triggered the issue by changing:

    - import { iconCollection } from './build/customIconCollection.js'
    + import { iconCollection } from './build/customIconCollection.ts'
  3. The exact failure path in our codebase:

    • Tailwind CSS internally calls require('./tailwind.config.js')
    • Node.js 22.12+ attempts to handle our ESM config with native require(esm)
    • Our config imports customIconCollection.ts which uses import.meta.url (ESM-only)
    • The native require fails because it can't handle TypeScript + ESM features
    • Critical: Node.js leaves poisoned/invalid entries in require.cache
  4. Cache poisoning causes the actual error:

    • Tailwind falls back to jiti after the failed require
    • Jiti checks Node's require.cache and finds the poisoned entries
    • The @iconify/tailwind module is returned as {} instead of the actual module
    • Line 226: addDynamicIconSelectors({}) tries to call an empty object
    • Result: "Cannot read properties of undefined (reading 'call')"

The Fix

Tailwind CSS 3.4.17 includes a workaround that forces jiti to always handle config loading, completely bypassing Node's problematic require(esm) attempt. This prevents the cache poisoning issue entirely.

Related Issues & PRs

Impact

This upgrade is required for compatibility with:

  • Node.js 22.12.0 and later
  • Node.js 23.x

Without this fix, the build fails completely when using Tailwind plugins with these Node versions.

┆Issue is synchronized with this Notion page by Unito

Fixed PostCSS build error "Cannot read properties of undefined (reading 'call')"
that occurred with tailwindcss 3.4.4 when using Node.js 22.12+.

The issue was caused by Node.js module resolution changes that broke plugin
loading. Tailwind CSS 3.4.17 includes a workaround that always uses jiti
for config loading to ensure consistent module resolution.

Refs: tailwindlabs/tailwindcss#15374, tailwindlabs/tailwindcss#15421

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@benceruleanlu benceruleanlu requested a review from a team as a code owner August 28, 2025 05:44
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 28, 2025
@github-actions
Copy link

github-actions bot commented Aug 28, 2025

🎭 Playwright Test Results

All tests passed across all browsers!

⏰ Completed at: 08/28/2025, 06:08:21 AM UTC

📊 Test Reports by Browser


🎉 Your tests are passing across all browsers!

@socket-security
Copy link

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedsemver@​7.7.210010010085100

View full report

@DrJKL
Copy link
Contributor

DrJKL commented Aug 28, 2025

I think I'd rather we set the minimum node version to 24, and hopefully get rid of the tailwind config with the v4 upgrade.

@DrJKL
Copy link
Contributor

DrJKL commented Aug 30, 2025

This should be resolved by #5246 and #5248

@DrJKL DrJKL closed this Aug 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants