Skip to content

chore: deprecate ResolvedConfig.createResolver and recommend createIdResolver#20031

Merged
sapphi-red merged 4 commits intovitejs:mainfrom
hi-ogawa:chore-deprecate-resolvedConfig-createResolver
May 14, 2025
Merged

chore: deprecate ResolvedConfig.createResolver and recommend createIdResolver#20031
sapphi-red merged 4 commits intovitejs:mainfrom
hi-ogawa:chore-deprecate-resolvedConfig-createResolver

Conversation

@hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented May 13, 2025

Description

Tanstack team (@schiller-manuel) reported the issue about Tailwind' use of config.createResolver, which breaks since Tanstack start has environment named "server" instead of "ssr" TanStack/router#4132.

It looks like the comment is only in the implementation, but not in ResolvedConfig types, so people don't notice. I copied the same jsdoc to the type.

/**
* createResolver is deprecated. It only works for the client and ssr
* environments. The `aliasOnly` option is also not being used any more
* Plugins should move to createIdResolver(environment) instead.
* create an internal resolver to be used in special scenarios, e.g.
* optimizer & handling css @imports
*/
createResolver(options) {

@hi-ogawa hi-ogawa marked this pull request as ready for review May 13, 2025 00:48
sapphi-red
sapphi-red previously approved these changes May 13, 2025
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
@sapphi-red sapphi-red added the p1-chore Doesn't change code behavior (priority) label May 14, 2025
@sapphi-red sapphi-red merged commit d101d64 into vitejs:main May 14, 2025
16 checks passed
@hi-ogawa hi-ogawa deleted the chore-deprecate-resolvedConfig-createResolver branch May 14, 2025 10:00
moonlitusun pushed a commit to moonlitusun/vite that referenced this pull request May 25, 2025
…eIdResolver` (vitejs#20031)

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
RobinMalfait added a commit to tailwindlabs/tailwindcss that referenced this pull request Feb 17, 2026
…ts in `@tailwindcss/vite` (#19679)

<!--

👋 Hey, thanks for your interest in contributing to Tailwind!

**Please ask first before starting work on any significant new
features.**

It's never a fun experience to have your pull request declined after
investing a lot of time and effort into a new feature. To avoid this
from happening, we request that contributors create a discussion to
first discuss any significant new features.

For more info, check out the contributing guide:


https://github.com/tailwindcss/tailwindcss/blob/main/.github/CONTRIBUTING.md

-->

## 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](vitejs/vite#20031) 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

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
RobinMalfait added a commit to tailwindlabs/tailwindcss that referenced this pull request Feb 17, 2026
…ts in `@tailwindcss/vite` (#19679)

<!--

👋 Hey, thanks for your interest in contributing to Tailwind!

**Please ask first before starting work on any significant new
features.**

It's never a fun experience to have your pull request declined after
investing a lot of time and effort into a new feature. To avoid this
from happening, we request that contributors create a discussion to
first discuss any significant new features.

For more info, check out the contributing guide:


https://github.com/tailwindcss/tailwindcss/blob/main/.github/CONTRIBUTING.md

-->

## 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](vitejs/vite#20031) 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

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p1-chore Doesn't change code behavior (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants