a month ago
Im getting 502 when i want to start the project, my understanding it should work i have similar other Vite projects
The start command i use and same for others is "start": "vite preview --port ${PORT} --host 0.0.0.0"
project id: b41bf0f5-9f9a-470e-a4f2-5e12b42fdaba
0 Replies
a month ago
A note to the community: please help this user switch to Caddy, running a development server is not ideal
a month ago
If your project is an SPA (no SSR), you can put railpack.json in the root of your repo with the following:
{
"$schema": "https://schema.railpack.com"
}Make sure to remove the start command from your package.json as you'll stop using Vite dev server in favor of Caddy.
Also make sure to update your vite.config.ts to do prerender so that your build produces index.html:
tanstackStart({
// any other config you need
prerender: {
enabled: true,
crawlLinks: false
}
}),And finally add this env var to your service:
RAILPACK_SPA_OUTPUT_DIR=dist/clienta month ago
If it's not an SPA and you need SSR. You'll need a custom start command, and set this env in your service: RAILPACK_NO_SPA=1 .
Right now as per tanstack start docs, for running a node server they suggest nitro (see here)
Add this to your package.json dependencies (nitro v3 only supports nightly):
"nitro": "npm:nitro-nightly@latest",then run your install command.
Update your vite.config.ts with:
import { nitro } from 'nitro/vite'
export default defineConfig({
// your config...
plugins: [
nitro(),
// your other plugins...
],Update your package.json scripts to:
"build": "vite build",
"start": "node .output/server/index.mjs"And that should be it. If you do run into issues lmk.
a month ago
Hey @MariuzM did you solve your problem already?