TanStack Start dev server fails with NitroViteError: Vite environment "ssr" is unavailable after running @hey-api/openapi-ts #4180
|
Hi, I’m trying to integrate Hey API into a fresh TanStack Start project. I’m not sure whether this is a bug in Hey API, TanStack Start, Nitro, or if I’m missing some configuration. Environment
Steps to reproduce
export default { input: "http://localhost:5239/openapi/v1.json", output: "../../client/src/api/generated", plugins: ["@hey-api/client-fetch"], };
Expected behavior The application should start normally. Actual behavior The development server immediately fails with: NitroViteError: Vite environment "ssr" is unavailable Stack trace: Vite environment "ssr" is unavailable What I already verified
At this point it seems that simply running the generator is enough to leave the TanStack Start dev server in a broken state, even though the generated files are never imported. Is this a known issue, or is there a recommended way to integrate Hey API with TanStack Start? |
Replies: 1 comment 2 replies
|
One cache worth checking for TanStack Start is rm -rf .vinxi .vite .nitro .output node_modules
npm install
npm run devThe recommended integration is just to keep generation as an explicit script, ideally writing inside the app package: {
"scripts": {
"api:generate": "openapi-ts"
},
"devDependencies": {
"@hey-api/openapi-ts": "latest"
}
}not sure about the Nitro/Vite |
@hey-api/openapi-tsshouldn’t touch Vite/Nitro state. It reads the config, fetches the OpenAPI spec, and writes files tooutput; ifpackage.json/ lockfile don’t change and the generated files aren’t imported, there isn’t an expected path where it would make the TanStack Start dev server fail.One cache worth checking for TanStack Start is
.vinxiin addition to.vite,.nitro, and.output:The recommended integration is just to keep generation as an explicit script, ideally writing inside the app package:
{ "scripts": { "api:generate": "openapi-ts" }, "devDependencies": { "@hey-api/openapi-ts": "latest" } }not s…