fix(vite): merge user resolve.conditions instead of overwriting them - #20429
fix(vite): merge user resolve.conditions instead of overwriting them#20429wook10 wants to merge 2 commits into
Conversation
@tailwindcss/vite's CSS resolver hardcodes conditions: ['style', 'development|production'], overwriting any conditions the user passed via resolve.conditions in their Vite config instead of merging with them. This happened in both the pre-Environment-API and Environment API resolver branches. Fixes tailwindlabs#20426
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. WalkthroughThe Vite plugin now appends user-defined Merge Risk: ⚪ Minimal · up to The PR preserves Vite's built-in CSS resolution conditions while honoring user-configured conditions, with a regression test covering the affected behavior; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Confidence Score: 5/5The PR appears safe to merge. The previously reported legacy resolver coverage gap is addressed by an independent Vite 5.3.5 integration case, and no blocking failure remains. Reviews (2): Last reviewed commit: "test(vite): cover legacy (pre-Environmen..." | Re-trigger Greptile |
Greptile flagged that the regression test only exercised the newer Environment API path (Vite 8). Parameterize it over Vite 8 and Vite 5.3.5 so both resolver branches that got the conditions-merge fix are covered.
|
Good catch — the regression test only covered the Environment API path. Pushed a follow-up commit parameterizing it over Vite 8 and Vite 5.3.5 so both resolver branches are exercised. |
Summary
@tailwindcss/vite's CSS resolver hardcodesconditions: ['style', 'development|production']in two places inpackages/@tailwindcss-vite/src/index.ts(the pre-Environment-API branch and the newer Environment API branch). This overwrites anyresolve.conditionsthe user configured in their Vite config instead of merging with them, so a package that relies on a custom export condition for its CSS entry point silently falls back to the default/style export.This PR appends the user's configured
resolve.conditions(if any) to the built-in conditions at both call sites instead of replacing them.Test plan
integrations/vite/resolvers.test.tsusing a local workspace package with a conditional CSS export, asserting that a customresolve.conditionsentry is honored by the CSS resolver during a production build.viteintegration job) — I wasn't able to build@tailwindcss/oxidelocally (no Rust toolchain in my current environment) to run the full integration suite, so I'd appreciate CI confirming this on all platforms.Fixes #20426