Skip to content

Fallback to config.createResolver for client and ssr environments in @tailwindcss/vite#19679

Merged
RobinMalfait merged 4 commits intotailwindlabs:mainfrom
4ndv:create-resolver-compat
Feb 17, 2026
Merged

Fallback to config.createResolver for client and ssr environments in @tailwindcss/vite#19679
RobinMalfait merged 4 commits intotailwindlabs:mainfrom
4ndv:create-resolver-compat

Conversation

@4ndv
Copy link
Contributor

@4ndv 4ndv commented Feb 15, 2026

Summary

Sometimes even if Vite Envrionment API is available, some plugins are still override config.createResolver function to inject own aliases

Since technically config.createResolver was only properly deprecated in Vite 7.0.0, it's still a valid(-ish) to do so, even if it wasn't ever officially supported

Vite already handles this in its internal css resolvers, but not exposes the code to do so as part of public API, so I've copied and adapted it

Fixes #19677

Test plan

Tested by copying built package into my repro from the issue, also ran vite integration tests

@4ndv 4ndv requested a review from a team as a code owner February 15, 2026 10:04
@4ndv 4ndv changed the title Fallback to config.createResolver for client and ssr environments Fallback to config.createResolver for client and ssr environments in @tailwindcss/vite Feb 15, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 15, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

Vite type imports were expanded to include InternalResolveOptions. A new createBackCompatIdResolver wrapper was added to route ID resolution to an existing compatibility resolver for client/SSR cases or to Vite’s resolver otherwise; calls to vite.createIdResolver for CSS and JS now use this wrapper and a local ResolveIdFn type was introduced. A unit test ("import aliases should work in <style> blocks") was added for Astro v5 import-alias resolution, css was exported from the test utilities, and CHANGELOG.md was updated with an Astro v5 stability note.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a fallback to config.createResolver for client and ssr environments in @tailwindcss/vite.
Description check ✅ Passed The description explains the motivation (config.createResolver overrides in plugins), implementation approach (copying Vite's internal resolver logic), and references the linked issue #19677 that it addresses.
Linked Issues check ✅ Passed Changes implement the core requirement to restore alias resolution compatibility when plugins override config.createResolver [#19677]. The new resolver wrapper handles both standard Vite Environment API resolution and fallback to config.createResolver for client/ssr cases, directly addressing the Astro v5 incompatibility issue.
Out of Scope Changes check ✅ Passed All changes are in scope: the resolver compatibility wrapper addresses the core issue, the test case validates the fix works with Astro, and the changelog entry documents the fix.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Member

@RobinMalfait RobinMalfait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Added an integration test to make sure this solves the issue you are seeing.

@RobinMalfait RobinMalfait enabled auto-merge (squash) February 17, 2026 19:54
@RobinMalfait RobinMalfait merged commit bc6e4b8 into tailwindlabs:main Feb 17, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@tailwindcss/vite v4.1.18 is not compatible with astro v5 aliases

2 participants

Comments