Start: Custom Nitro config, post vinxi→vite migration
Which project does this relate to?
Start
Describe the bug
Firstly, amazing work with the migration away from vinxi that dropped in 1.120. Unexpected, but awesome nonetheless.
On the old setup, I previously was able to configure nitro, e.g.:
// app.config.ts
server: {
preset: 'aws-lambda',
awsLambda: {
streaming: true
}
}
Now, I am only able to set target i.e. nitro's preset field, but not pass any additional nitro config.
Suggested fix
// vite.config.ts
tanstackStart({
nitro: {
preset: 'aws-lambda',
awsLambda: {
streaming: true
}
}
})
-
nitrowould be spread on top of https://github.com/TanStack/router/blob/main/packages/start-plugin-core/src/nitro-plugin/plugin.ts#L73-L103 - optionally, nitro could accept a merge function
If it's not already in the works, I am willing to submit a PR.
Your Example Website or App
https://codesandbox.io/p/devbox/github/tanstack/router/tree/main/examples/react/start-basic?embed=1&file=%2Fvite.config.ts&theme=dark
Steps to Reproduce the Bug or Issue
- Open sandbox
- Try passing nitro config params to tanstackStart vite plugin
Expected behavior
I can continue to pass nitro config to the build server
Screenshots or Videos
No response
Platform
Any platform
Additional context
No response
This would be great. Currently facing the same struggle.
This can be resolved by creating a nitro.config.ts in the same directory.
export default defineNitroConfig({
awsLambda: {
streaming: true,
},
});
It seems like all the options can be added / augmented except for compatibility date
There are more recent versions of the build instructions from nitro that currently can't be used because the compatibility date can't be overridden.
Is there a way to either allow users to enter their own compatibility date, or at the very least change it to "latest" so we can pick up recent additions?
Running into the same issue, unable to build for aws-lambda on the latest tanstack router / start version using vite.config.js instead of app.config.ts; it always builds for node-server
This can be resolved by creating a
nitro.config.tsin the same directory.export default defineNitroConfig({ awsLambda: { streaming: true, }, });
This fixed it for me; also had to update the preset:
import { defineNitroConfig } from 'nitropack/config';
export default defineNitroConfig({
preset: 'aws-lambda',
awsLambda: {
streaming: true,
},
});
Yeah. It looks like all config options except for "compatibility date" can be overridden.
Not that there are a lot of needed updates, but I figure that as new features on deno / cloudflare / netlify, etc get introduced, we should be able to support them.
https://nitro.build/deploy#compatibility-date
UPDATE: it looks like there are more updates than what's listed on the website. There's no new update for "firebaseAppHosting" listed but if you patch @tanstack/start-plugin-core and set it to latest, you'll get a compatibility date of 2025-06-08.
/* @tanstack/start-plugin-core/src/nitro-plugin/plugin.ts */
const nitroConfig: NitroConfig = {
dev: false,
// TODO: do we need this? should this be made configurable?
compatibilityDate: '2024-11-19', // <--- change to 'latest' or comment out and set in `nitro.config.ts`
logLevel: 3,
...
}
Firebase App Hosting
✔ Generated public .output/public nitro 10:20:05 AM
ℹ Building Nitro Server (preset: firebase-app-hosting, compatibility date: 2025-06-08) nitro 10:20:05 AM
✔ Nitro Server built
Cloudflare Module
ℹ Building Nitro Server (preset: cloudflare-module, compatibility date: 2025-06-08)
This fixed it for me; also had to update the preset:
Just to clarify, I also had target set in my vite.config.ts
// vite.config.ts
tanstackStart({
nitro: {
preset: 'aws-lambda',
}
})
Also ran into this issue when I needed to set streaming. Using a custom nitro.config.ts worked as a workaround, but configuring this directly in the Vite plugin would feel more natural imho.
Ref: https://github.com/TanStack/router/pull/4192
we will most likely decouple start from nitro and add a separate start-nitro vite plugin. this start-nitro plugin can then contain all the config for nitro
I know start is still v0 but shipping a huge breaking change with no docs is pretty painful!
theres a good example for it here for anyone doing the migration: https://github.com/sst/sst/tree/dev/examples/aws-tanstack-start-vite
Hey, I also had this issue after the recent update. The examples in SST didn't help, at least for me; the separate nitro config does not seem to connect to Vite.
This worked:
- npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5215
- add this config:
import { defineConfig } from "vite";
import tsConfigPaths from "vite-tsconfig-paths";
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
import viteReact from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
import { livestoreDevtoolsPlugin } from "@livestore/devtools-vite";
import { nitroV2Plugin } from "@tanstack/nitro-v2-vite-plugin";
export default defineConfig({
server: {
port: 3000,
allowedHosts: [
process.env.MONOLITH_URL_PROXY?.replace(/^https?:\/\//, "")!,
],
},
css: {
devSourcemap: true,
},
plugins: [
tsConfigPaths(),
tailwindcss(),
tanstackStart(),
nitroV2Plugin({
preset: "aws-lambda",
compatibilityDate: "2025-09-25",
}),
viteReact(),
livestoreDevtoolsPlugin({ schemaPath: "./src/lib/sync-engine/schema.ts" }),
],
});
seems like the nitroV2Plugin solves the issue for now. I wanted to use the Nitro v3 plugin, but I couldn't find a way to import it.
if anyone manages to make it work let me know.
nitro config goes into the nitro vite plugin now.
https://tanstack.com/start/latest/docs/framework/react/hosting#using-nitro-v2
That's now a 404 @schiller-manuel