Updating tanstack router causes crash
Update 1.120.5 -> 1.121.2
I updated the deprecated vite plugin
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
-> import { tanstackRouter } from "@tanstack/router-plugin/vite";
plugin usage:
But both cause crashes on startup:
19 Replies
rare-sapphire•3mo ago
You'll need vite v6
deep-jadeOP•3mo ago
that was it, thanks
shouldn't this be considered a breaking change?
rare-sapphire•3mo ago
If truly following semver, yes, as before v5 was permitted. I've raised a PR to correct the peer dep, but maybe safe access to the environment config would be better
deep-jadeOP•3mo ago
uh... still crashing when i run tests (vitest 3.2.3)
rare-sapphire•3mo ago
same error when running tests?
deep-jadeOP•3mo ago
yes, same error
(though everything else works now, dev, build, etc..)
rare-sapphire•3mo ago
I don't use vitest in our TSR project, sorry. But I suspect it's the same issue, that the environment isn't available in vitest
deep-jadeOP•3mo ago
which environment?
rare-sapphire•3mo ago
deep-jadeOP•3mo ago
so it thinks its on the server because of node_env=test?
rare-sapphire•3mo ago
not quite, it's because vite plugins (like the TSR plugin) now can conditionally do things based on where it intends to be run,
this.environment
was introduced in v6
I don't know for sure, but I suspect it's also not available in current versions of vitestdeep-jadeOP•3mo ago
kk, guess ill revert the update then
rare-sapphire•3mo ago
could you raise a bug?
deep-jadeOP•3mo ago
sure
hmm... i cant seem to reproduce it on stackblitz with example
can you?
foreign-sapphire•3mo ago
sorry for this regression, support for vite 5 for the router-plugin is being restored in https://github.com/TanStack/router/pull/4420
deep-jadeOP•3mo ago
thank you 🙏
after these fixes (1.121.12), when running tests I get a new error:
this is what I'm doing in the global setup:
foreign-sapphire•3mo ago
could you please provide a complete example repo?
deep-jadeOP•3mo ago
uh... trying to make a minimal reproduction, i actually found out a new issue, its still throwing errors (though different) on dev command when using vite <6: https://stackblitz.com/edit/tanstack-router-reey8fqq?file=package.json,vite.config.js&preset=node
StackBlitz
Router Quickstart File Based Example (duplicated) - StackBlitz
Run official live example code for Router Quickstart File Based, created by Tanstack on StackBlitz
deep-jadeOP•3mo ago
just try running
npm run dev
should i make a github issue? or have you already made a pr/started fixing it?