48 Replies
generous-apricot•5d ago
It should be using vite 7 i think
continuing-cyanOP•5d ago
Yeah! Updating the package.json file created by the TanStack CLI to Vite 7.x resolved the issues with npm install and project run. Just reporting since its broken. Is there a better place to report and let the team know ? GH issues?
generous-apricot•5d ago
yeah probably. Im just not sure exactly what cli that uses
exotic-emerald•5d ago
cc @jherr
deep-jade•5d ago
on it.
i have no seen this. so... weird. but i'll upgrade it
exotic-emerald•5d ago
do we have the wrong command on the site?
deep-jade•5d ago
no, it's good. it's just an old dependency. just checking in a fix now.
not sure how it worked up until now...
maybe something that went into a recent Start build required a 7 feature, where nothing had before? or a downstream dependency?
fixed
ratty-blush•3d ago
@jherr @brenelz Critically
pnpm start
is also broken. It simply doesn't work. So project out of the box is not prod deployable.deep-jade•3d ago
Can you be a little more specific about that, did you
pnpm build
and then pnpm start
?
What was the error. "Doesn't work" isn't super helpful.ratty-blush•3d ago
Sure, yes out of the box prod build after running those two commands doesn't work
ratty-blush•3d ago

rising-crimson•3d ago
actually, in the latest tanstack start release, it outputs dist folder instead of
.output
, and the start command is expecting .output
folder which is not present
I think we might need to integrate the nitro plugin in the vite config to make this workratty-blush•3d ago
If you check the #start channel you will see lots of other users raising pitch forks as well due to this
ratty-blush•3d ago

ratty-blush•3d ago
And its confusing because solution like @amanmavai said is bringing either ntiro plugin again or add a server.ts that is using srvx to supply a server. Also didn't we just moved away from nitro so still installing it is confusing a lot of community here.
rising-crimson•3d ago
this is what I was referring to

rising-crimson•3d ago
start is not coupled with Nitro anymore, but we can use it as a separate plugin to make the build work in production
this kind of fixes the issue, but I was still facing another issue is that even after enabling the nitro plugin, we have
.output
folder generated and dist folder is also getting generated which is not ideal, since we are not using that
ideally only .output
folder should be generated and not the dist
folder
My expectation is that we should have few testcases to make sure we are always generating correct build output, and we don't break this stuff, this is causing lot of confusion.ratty-blush•3d ago
My workaround without using nitro plugin for now is to add srvx explicitly(can be skipped for npm as included with Tanstack start but required for pnpm) so
pnpm add srvx
and then add a server.ts
at root of project and change start script to be node server.ts
(require v22.18+ to work else use js extension)
My assumption of what is wrong here actually is that there is some logic missing in Tanstack start repo itself which is failing to make the dist/server/server.js not runnable.exotic-emerald•3d ago
there is nothing missing
dist/server/server.js will just build a request handler
it will not start a server
for that you either need to import that request handler in your custom server or use a deployment plugin such as nitro, or cloudflare, or netlify, ...
ratty-blush•3d ago
Oh ok so thats by design. I think then the create-start-app should by default have atleast one of the deployment plugin so that minimal example works, docs have some of the info I see but its not readily clear what to do when faced by this.
continuing-cyan•3d ago
RC migration guide has everything that needs to change. i did some changes in my existing code after going through the migration guide for the RC and everything is working fine for me in dev and in production aswell.
ratty-blush•3d ago
why would someone go to migration guide when they are starting project from scratch?
continuing-cyan•3d ago
the project that generated by the cli is still not updated.
I tried to create the new project with the
bunx create-tanstack-app@latest --add-ons
and the the vite.config.ts
is still the old one. Which create the dist folder instead of .output and the package.json start script was using the .output folder.
same with the create-start-app
cause they all are same same.
probably it will fix soonrising-crimson•3d ago
will try this approach, this seems nice solution for now
This solution seems to work for
bun
as well. thanks so muchratty-blush•3d ago
I stole it from a bun discussion here so don't thank me much: https://discord.com/channels/719702312431386674/1420484044466159616/1420725535767789681
ratty-blush•3d ago
if want to use node this working for me now with nitroV2Plugin :
// vite.config.ts
import postgresPlugin from "@neondatabase/vite-plugin-postgres";
import tailwindcss from "@tailwindcss/vite";
import { devtools } from "@tanstack/devtools-vite";
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
import viteReact from "@vitejs/plugin-react";
import { nitroV2Plugin } from "@tanstack/nitro-v2-vite-plugin";
import { defineConfig } from "vite";
import tsConfigPaths from "vite-tsconfig-paths";
import { config } from "dotenv";
config();
export default defineConfig({
optimizeDeps: {
entries: ["src//*.tsx", "src//*.ts"],
exclude: ["katex"],
},
server: {
port: 3000,
},
plugins: [
devtools(),
tsConfigPaths({
projects: ["./tsconfig.json"],
}),
postgresPlugin(),
tailwindcss(),
tanstackStart({
srcDirectory: "src",
start: { entry: "./start.tsx" },
server: { entry: "./server.ts" },
router: {
routeToken: "layout",
},
}),
nitroV2Plugin({ preset: "node-server" }),
viteReact(),
],
});
ratty-blush•3d ago
@jherr @Manuel Schiller I raised a PR here to add a simple
server.js
file so that start script works out of the box without need of nitro, more details on the PR comment for you to review. Please merge if the change looks good to you.ratty-blush•3d ago
GitHub
Critical fix start script for tanstack start addon by SiddharthPant...
create-start-app creates a broken start script based on previous nitro plugin leftouts. This is creating lots of confusion whoever is trying to deploy on prod as server fails to start.
This PR adds...
deep-jade•3d ago
ok, @Siddharth Pant @Manuel Schiller @Tanner Linsley I've got a host system setup and you can see the various flavors here: https://github.com/jherr/ts-deployment-tests
GitHub
GitHub - jherr/ts-deployment-tests: Variants of the deployment setu...
Variants of the deployment setups for create-start-app - jherr/ts-deployment-tests
deep-jade•3d ago
@Siddharth Pant I think your
server.js
is for the Node variant?ratty-blush•2d ago
Yes. Should work with bun and in docker containers as well.
I saw you pushed lots of updates to netlify and cloudflare, which my PR had merge conflicts with. I have fixed the merge conflicts.
deep-jade•2d ago
I think the big PR superceded that. But lemme know if not.
@Manuel Schiller @Siddharth Pant is making the point that a hosting provider should be optional. I agree. Ok with you?
ratty-blush•2d ago
Oh I didn't notice that. Checked just now that nitro has been added as default and atleast the core issue is fixed now. Let me know if I should close the PR if Manuel decides against merging it.
deep-jade•2d ago
ok, i've moved the vite configs inline and now hosting is optional. which is good because Cloudflare was the first option and there are some compatibility issues with CF in the dev environment.
exotic-emerald•2d ago
what's the default then? no hosting? not such a good idea then. would default to nitro for now
deep-jade•2d ago
i honestly don't see why "no hosting" is a problem. it's basically; dev until you need to deploy, then go to the hosting page on the tanstack site and check out your options. personally, i don't generally worry about hosting until I actually want to host it.
exotic-emerald•2d ago
people have been complaining that they cannot run a prod build...
solid-orange•2d ago
it's worse than complaining : they are extremely confused
to the point where this issue has probably been the most frequent of all since RC
i've copy pasted my answer to tons of people
because it's (in my opinion) kind of weird to have an objectively erroneous "start" script bundled with a starter template
i feel like the good idea is to have a default universal srvx deployment solution, because it's just easy, and generate in the readme a really barebone guide on more involved hosting
ratty-blush•2d ago
As a Developer I want to have some defualt ( nitro is a good one because was before ) and not friction for the old/ new users
And some new dev will be test and its nice if dont take too more steps to host it
solid-orange•2d ago
just to add why i think srvx is a better default than nitro: it's just already the default output of ts start (dist/server/server.js exposes a srvx compatible fetcher)
honestly, you don't even need the explicit serve.ts file that runs srvx since it has a cli :
npx srvx -s ../client dist/server/server.js
works ootb
nothing to explicitly install in the project deps => one thing less to remove by the user once they want to move on to CF or Netlify etcdeep-jade•2d ago
but we do ask the user with the new
create-start-app
. we give them options. so if they choose nothing
and then can't build, that's basically on them.
we didn't give them options before.solid-orange•2d ago
then if they choose nothing, either have this default ^
or no start script in package.json
a fake (as in it just doesn't work) start script is worse than nothing imo
because all the tons of devs that reported the issue are not reporting it like "i don't know how to deploy" but as "hey there's a bug where it doesn't generate .output"
it's a forced XY problem
people think there is a bug (when there is not) and report that, and wait until someone tells them "well actually it's not a bug, it's just that you have to add the nitro plugin"
deep-jade•2d ago
ok, i've pulled
start
from the base (no hosting) configuration.
alright, fine, before y'all kill me I'll make nitro
the defaultratty-blush•2d ago
You are our teacher, we respect you too much to do any of that 🙂
Anyways let me kill my PR since its not needed anymore as we are all sorted now.
solid-orange•2d ago
i will haunt your dreams
(jk, great work on create-start-app)
ratty-blush•2d ago
we love you ❤️
deep-jade•2d ago
love you too! :blobthumbsup:
ratty-blush•2d ago
:tanner: