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
other-emerald•6mo ago
You'll need vite v6
flat-fuchsiaOP•6mo ago
that was it, thanks
shouldn't this be considered a breaking change?
other-emerald•6mo 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
flat-fuchsiaOP•6mo ago
uh... still crashing when i run tests (vitest 3.2.3)
other-emerald•6mo ago
same error when running tests?
flat-fuchsiaOP•6mo ago
yes, same error
(though everything else works now, dev, build, etc..)
other-emerald•6mo 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
flat-fuchsiaOP•6mo ago
which environment?
other-emerald•6mo ago
flat-fuchsiaOP•6mo ago
so it thinks its on the server because of node_env=test?
other-emerald•6mo 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 vitestflat-fuchsiaOP•6mo ago
kk, guess ill revert the update then
other-emerald•6mo ago
could you raise a bug?
flat-fuchsiaOP•6mo ago
sure
hmm... i cant seem to reproduce it on stackblitz with example
can you?
stormy-gold•6mo ago
sorry for this regression, support for vite 5 for the router-plugin is being restored in https://github.com/TanStack/router/pull/4420
flat-fuchsiaOP•6mo 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:
stormy-gold•6mo ago
could you please provide a complete example repo?
flat-fuchsiaOP•6mo 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
flat-fuchsiaOP•6mo ago
just try running
npm run dev
should i make a github issue? or have you already made a pr/started fixing it?