Fix v3 config loading with Jiti re-exports#448
Merged
Boshen merged 1 commit intotailwindlabs:mainfrom Feb 5, 2026
Merged
Conversation
d8ae771 to
1dda800
Compare
1dda800 to
5f1f9aa
Compare
Contributor
Author
|
@Boshen cc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #431
Summary
The crash happens when a Tailwind v3 config is an ESM file that re‑exports from a workspace package which itself is loaded via Jiti (v2). Our plugin’s v3 loader used Tailwind’s
loadConfig, which internally uses Jiti v1 and returns a Proxy. When that Proxy touches modules loaded via Jiti v2, the getters recursively call each other, causingRangeError: Maximum call stack size exceeded.Where it happens
src/versions/v3.ts, the old path wasloadConfig(jsConfig)(Tailwind v3’s loader). That loader uses Jiti v1 internally.tailwind.config.mjsthat re‑exports@repo/tailwind-config. That package uses Jiti v2 (via unbuild’s stub), creating the v1/v2 Proxy recursion.Why the fix works
loadConfigand uses our own Jiti v2 import (createJiti(...).import(...)) directly. That eliminates the mixed Jiti versions and prevents the Proxy recursion, so the config loads normally.All done by
Codex. I improved it a little and confirmed that this works well in the reproduction in #431.