T
TanStack2mo ago
provincial-silver

No client assets in production

Hi all, I am new to TanStack, and I am using TanStack Start with SolidJS to build a web app. I am using TailwindCSS for styling, and in development, everything works as expected. However, the output from build does not work. I see a "server" and a "client" directory in "dist", so I run the file "dist/server/server.js" with bun. The app still works, but there is no styling. When I check the networks, all the client assets such as css files are not found. Could you show me how to run the build correctly? I think this is not the correct way to run the build, but there is no document about this,
9 Replies
foreign-sapphire
foreign-sapphire2mo ago
Hi , server.js exports fetch that you can serve that by Srvx , bun serve and the like But have you checked this page ? https://tanstack.com/start/latest/docs/framework/react/hosting
Hosting | TanStack Start React Docs
Hosting is the process of deploying your application to the internet so that users can access it. This is a critical part of any web development project, ensuring your application is available to the...
provincial-silver
provincial-silverOP2mo ago
Hi @AMIR , thanks for the reply. I just checked out this page and I am able to make it work with both Srvx, and with the Nitro vite plugin. Thank you so much. Then, I am also curious, which one is the preferred way to run tanstack app in production? Why do we have 2 different output structure?
quickest-silver
quickest-silver2mo ago
which one is the preferred way to run tanstack app in production
whatever suits your needs really you can also embed start into a custom server (e.g. express) it really depends on what you are building
provincial-silver
provincial-silverOP2mo ago
Well, I plan to run the webapp (with SSR) in a docker container. Does it make a difference if I use nitro or srvx?
quickest-silver
quickest-silver2mo ago
nitro moves the relevant node modules into the .output folder, so you end up with a smaller docker image
foreign-sapphire
foreign-sapphire2mo ago
As far as I know, there isn’t much difference, but there are a few things you should pay attention to. For example, if you’re not using a CDN, it’s better to compress assets statically at build time — Nitro can handle that, and there are also some plugins that can help with it. Nitro uses srvx under the hood. It provides some additional features you might find useful, but note that some features in Nitro aren’t fully functional yet — they may be fixed in Nitro v3.
provincial-silver
provincial-silverOP2mo ago
I see, so with the nitro bundle, I don't have to bring the node_modules directory along to the final Docker image.
quickest-silver
quickest-silver2mo ago
you do, but only the one inside .output which is most likely smaller than the project one's try it out and you will see what i mean
provincial-silver
provincial-silverOP2mo ago
I will. Thanks for the insight 🙂

Did you find this page helpful?