feat!: support React Router v8 in the react-router preset - #625
Open
antfu wants to merge 2 commits into
Open
Conversation
react-router-dom has no v8 — the package was removed and everything it exported moved into react-router. Extract the shared names into ReactRouterDomExports and spread them into both presets, so the react-router preset now also covers Link, NavLink, Navigate, Outlet, Route, Routes, useSearchParams and useLinkClickHandler. BREAKING CHANGE: those names are not on react-router's main entry in v6 or v7, so the react-router preset now generates imports that do not resolve for consumers still on those majors. They should use the react-router-dom preset, whose contents are unchanged. Migrates the vite-react example onto react-router v8 accordingly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
commit: |
The preset stays and its resolved list is unchanged, so v6 and v7 users keep working. The tag records that the package is gone in v8 and points at the react-router preset. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Why
react-router-domhas no v8 — the package was removed in that major and everything it exported moved intoreact-routeritself. Thereact-routerpreset only lists the v6 hooks, so on v8 it no longer covers the components and hooks users actually need.Split out of the dependency-update sweep on
mainbecause it is a breaking change to a shipped preset.What
Extracts the names that used to be
react-router-dom-only intoReactRouterDomExportsand spreads them into both presets. Thereact-routerpreset now also covers:Link·NavLink·Navigate·Outlet·Route·Routes·useSearchParams·useLinkClickHandlerBrowserRouter/HashRouter/MemoryRouterstay commented out, as before — they are called once and are not a good fit for auto-import.The
vite-reactexample is migrated onto react-router v8:react-router-domdropped from its dependencies,BrowserRouterimported fromreact-router, and the preset name updated in itsvite.config.ts.The
react-router-dompreset is keptIt is not removed, and its resolved import list is byte-identical to before — only its construction changed, so it now shares the two extracted arrays. v6 and v7 users who use that preset are unaffected.
It carries a
@deprecatedtag recording that the package is gone in v8 and pointing at thereact-routerpreset. Note this is source-level documentation: presets are bundled internals, so the tag does not reach the published.d.mts, and the publicPresetNamestring union cannot carry per-member deprecation. README already points readers atsrc/presetsdirectly.The
react-routerpreset's output is unconditional — it always returns the v8 list. Those names are not onreact-router's main entry in v6 or v7, so consumers on those majors who use thereact-routerpreset will get generated imports that do not resolve.Migration: switch to the
react-router-dompreset, which is unchanged.This was a deliberate choice over making
react-routera version-aware function preset (which the codebase supports — see@vueuse/core): keeping the output static means preset results stay predictable and independent of install state.Verification
build,typecheck,lintand all 41 tests pass. Every example and the playground build, includingtsc && vite buildforvite-react.🤖 Generated with Claude Code