You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(router-plugin): remove plugin.hmr.style and HmrOptions - #8856
Split out of #8817 to make that PR smaller. config.ts and index.ts get the same changes #8817 makes. #8817 rewrites or deletes the other files touched here, so a rebase only needs to keep #8817's versions of them.
Why
plugin.hmr.style ('vite' | 'webpack') was undocumented and never useful to set yourself:
The webpack and Rspack entries overwrote whatever you passed with 'webpack'.
On Vite, 'webpack' emitted import.meta.webpackHot, so route HMR stopped working without any error.
The changeset is a patch, like #8853: the option was undocumented, and nobody could use it to get anything except the default.
Changes
plugin.hmr is removed from the config schema, and the HmrOptions type is no longer exported from @tanstack/router-plugin.
The HMR style is now an internal parameter.createRouterCodeSplitterPlugin and createRouterHmrPlugin take it as an argument, with 'vite' as the default:
the composed plugin (tanstackRouter) picks it from the bundler unplugin reports (webpack/rspack → 'webpack');
the standalone TanStackRouterCodeSplitter{Webpack,Rspack} entries pass 'webpack'.
The internal HmrStyle type moves from core/config.ts to core/hmr.
tanstackRouter from /webpack and /rspack now passes unpluginRouterComposedFactory to unplugin directly, so its options parameter has the Vite entry's type (Partial<Config | (() => Config)>) instead of unknown. That type still accepts every value except null.
Tests: the webpack route-HMR test in code-splitter-plugin-pipeline.test.ts now passes the style through the test helper instead of plugin.hmr.style.
Nothing in packages/, examples/, e2e/ or docs/ used the option. This only changes build-time plugin code, so no client bundle changes.
Validation
@tanstack/router-plugin: test:unit, test:types, test:eslint and test:build pass. @tanstack/start-plugin-core: test:unit and test:types pass.
The composed tanstackRouter entries emit the same code as on main. Development builds of examples/react/quickstart-webpack-file-based (webpack) and e2e/react-router/rspack-basic-file-based (Rspack), with autoCodeSplitting on and off, are byte-identical to main's (Rspack: apart from the build timestamp and hash). With splitting on, both emit the webpack-style route HMR code.
e2e/react-start/hmr (route HMR on Vite, Vite bundled dev and Rsbuild) passes in CI.
Route hot reloading now uses the appropriate runtime for each bundler, resolving issues with Vite and preserving compatibility with Webpack and Rspack.
Configuration Changes
Removed the undocumented plugin.hmr.style setting. HMR style is selected automatically based on the bundler, so this option can no longer be used to override it.
The option was undocumented. The webpack and Rspack entries overwrote it
with `'webpack'`, and on Vite `'webpack'` emitted `import.meta.webpackHot`,
which broke route HMR. The HMR style is now an internal parameter: the
composed plugin derives it from the bundler unplugin reports, and the
standalone webpack/Rspack code-splitter entries pass `'webpack'`.
Split out of #8817.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The router plugin removes the plugin.hmr.style configuration option and the HmrOptions type. Bundler-specific plugin wiring now selects and passes the HMR style to HMR and code-splitter plugins.
Changes: Router plugin HMR style selection
Layer / File(s)
Summary
HMR style type and configuration .changeset/router-plugin-remove-hmr-style.md, packages/router-plugin/src/core/config.ts, packages/router-plugin/src/core/hmr/*, packages/router-plugin/src/core/code-splitter/plugins*, packages/router-plugin/src/index.ts
The configuration schema and public exports drop HMR style configuration. The HMR module defines and exports HmrStyle, which its consumers now import from that module.
Bundler style selection and propagation packages/router-plugin/src/core/router-code-splitter-plugin.ts, packages/router-plugin/src/core/router-composed-plugin.ts, packages/router-plugin/src/core/router-hmr-plugin.ts, packages/router-plugin/src/webpack.ts, packages/router-plugin/src/rspack.ts
The composed plugin selects an HMR style from framework metadata and passes it to the HMR and code-splitter plugins. Webpack and Rspack entries pass webpack style directly and no longer rewrite plugin options.
HMR style test helpers packages/router-plugin/tests/code-splitter-plugin-pipeline.test.ts, packages/router-plugin/tests/regression-helpers.ts
The test helpers accept and forward an optional HMR style. The webpack HMR test selects webpack style through the helper.
TanStack/router#8804: This PR changes the same plugin factory signatures and wiring to pass framework metadata, which overlaps with this PR’s HMR style argument and selection.
Suggested labels:package: router-plugin
Suggested reviewers:schiller-manuel
Merge Risk: Moderate · up to 092d4
A patch upgrade may break builds that use the removed API. Confirm that this compatibility impact is acceptable before merging.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title names the main change: removing the undocumented plugin.hmr.style option and the HmrOptions type from @tanstack/router-plugin. The raw summary confirms the config schema drops hmr, `…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description clearly explains the motivation, implementation changes, API impact, testing, release impact, and AI authorship. It does not include the template's exact Checklist and Release Impact h…
Full details: Title check
Explanation
The title names the main change: removing the undocumented plugin.hmr.style option and the HmrOptions type from @tanstack/router-plugin. The raw summary confirms the config schema drops hmr, HmrOptions is no longer exported, and HMR style becomes an internal parameter. The refactor prefix is a reasonable label for this internal change. The title is specific and concise.
Full details: Description check
Explanation
The description clearly explains the motivation, implementation changes, API impact, testing, release impact, and AI authorship. It does not include the template's exact Checklist and Release Impact headings or checkbox items, but it provides the required information in equivalent sections.
Full details: Docstring Coverage
Explanation
Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 12 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
2-2: Major · Data Integrity & Integration · Quick win
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Do not release these API removals as a patch.
Existing TypeScript users can no longer import HmrOptions or pass plugin.hmr.style. A patch upgrade can therefore break their builds. (raw.githubusercontent.com)
Retain the deprecated API until a major release, or release the removals as a major version.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.
⚠️1 benchmark with a significant change ran on different hardware
Its base and head results were measured on machines with a different CPU, core count or memory, so the change might not come from the code. Run base and head on the same runner type.
Main landed parts of this PR separately against the old compiler
(#8851, #8852, #8853, #8855, #8856) and re-enabled the router-utils unit
tests (#8849): the PR already has each of them. The old-compiler files
main edited stay deleted; the entries keep the PR's implementation (same
esbuild error message). Main's changesets stay; the duplicated bullets
leave the PR's router-plugin, route generator and compiler core
changesets. The router plugin skill takes main's esbuild wording.
#8857 (route-group layouts typed with full path '/'): the PR's generator
already types them '/'. Main's test that a childless `_auth.tsx` next to
the index route conflicts is dropped: SPEC J1.15 makes that pair valid
here (route-paths.test.ts checks it through the router).
Co-Authored-By: Claude Opus 5.5 <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
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.
Split out of #8817 to make that PR smaller.
config.tsandindex.tsget the same changes #8817 makes. #8817 rewrites or deletes the other files touched here, so a rebase only needs to keep #8817's versions of them.Why
plugin.hmr.style('vite' | 'webpack') was undocumented and never useful to set yourself:'webpack'.'webpack'emittedimport.meta.webpackHot, so route HMR stopped working without any error.The changeset is a patch, like #8853: the option was undocumented, and nobody could use it to get anything except the default.
Changes
plugin.hmris removed from the config schema, and theHmrOptionstype is no longer exported from@tanstack/router-plugin.createRouterCodeSplitterPluginandcreateRouterHmrPlugintake it as an argument, with'vite'as the default:tanstackRouter) picks it from the bundler unplugin reports (webpack/rspack→'webpack');TanStackRouterCodeSplitter{Webpack,Rspack}entries pass'webpack'.HmrStyletype moves fromcore/config.tstocore/hmr.tanstackRouterfrom/webpackand/rspacknow passesunpluginRouterComposedFactoryto unplugin directly, so itsoptionsparameter has the Vite entry's type (Partial<Config | (() => Config)>) instead ofunknown. That type still accepts every value exceptnull.code-splitter-plugin-pipeline.test.tsnow passes the style through the test helper instead ofplugin.hmr.style.Nothing in
packages/,examples/,e2e/ordocs/used the option. This only changes build-time plugin code, so no client bundle changes.Validation
@tanstack/router-plugin:test:unit,test:types,test:eslintandtest:buildpass.@tanstack/start-plugin-core:test:unitandtest:typespass.tanstackRouterentries emit the same code as on main. Development builds ofexamples/react/quickstart-webpack-file-based(webpack) ande2e/react-router/rspack-basic-file-based(Rspack), withautoCodeSplittingon and off, are byte-identical to main's (Rspack: apart from the build timestamp and hash). With splitting on, both emit the webpack-style route HMR code.e2e/react-start/hmr(route HMR on Vite, Vite bundled dev and Rsbuild) passes in CI.🤖 Generated with Claude Code
Summary by CodeRabbit
plugin.hmr.stylesetting. HMR style is selected automatically based on the bundler, so this option can no longer be used to override it.