Minimal reproduction for an Invalid hook call that occurs when a runtime-loaded Vite remote uses @tanstack/router-plugin@1.168.17 and the host has created a separate TanStack Router instance in the same browser window.
- React
18.3.1 - Vite
7.3.1 @tanstack/react-router1.168.17- failing
@tanstack/router-plugin1.168.17 - working control version
1.168.16 @module-federation/vite1.19.1
Requirements: Node.js 20.19+ and npm.
npm install
npm run reproOpen:
http://localhost:4173
Then click Load and mount remote.
The command intentionally runs the applications in different modes:
host: production build + vite preview on http://localhost:4173
remote: vite dev server on http://localhost:5174
Expected failing result with @tanstack/router-plugin@1.168.17:
Invalid hook call. Hooks can only be called inside of the body of a function component.