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
router-plugin: object-form loader breaks the code splitter when loader is split #8753
The script runs compileCodeSplitReferenceRoute and compileCodeSplitVirtualRoute from @tanstack/router-plugin 1.168.47 on the route above, with groupings [['loader'], ['component']].
See loader: lazyFn($$splitLoaderImporter, 'loader') in the route file and Unexpected splitNode type ☝️: ObjectExpression from the loader chunk.
A Vite dev server with tanstackRouter({ target: 'react', autoCodeSplitting: true, codeSplittingOptions: { defaultBehavior: [['loader'], ['component']] } }) gives the same output and the same error from server.transformRequest('/src/routes/index.tsx?tsr-split=loader').
Expected behavior
Only handler moves to the loader chunk, and the route file keeps the other options:
A module-level binding read by both handler and another loader option should go to the ?tsr-shared=1 module, like any binding a split option shares with one that stays.
Screenshots or Videos
No response
Platform
Router / Start Version: @tanstack/router-plugin 1.168.47; also on main (b1b1117)
OS: macOS
Browser: n/a (build time)
Browser Version: n/a
Bundler: vite
Bundler Version: 8.3.4
Additional context
#8630 pins this as a known failure, and #8504 fixes it as part of the Yuku migration. I'll open a small fix for the current compiler. A loader object passed by reference (loader: loaderObject, the second pin in #8630) is a different case and not covered here.
AI disclosure: Claude Code wrote this report and the reproducer, and ran the reproducer against 1.168.47.
Activity
Sheraff commentedon Oct 18, 2026
FWIW we're in the process of rewriting the entire compiler