-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running vite: Cannot modify fastify route without crashing. #33
Comments
can you provide a repro? I could create new route without any problem. |
+1
// package.json
"@nestjs/cli": "^10.3.2",
"@nestjs/common": "^10.3.3",
"@nestjs/core": "^10.3.3",
"@nestjs/platform-fastify": "^10.3.3",
"@swc/cli": "^0.3.10",
"@swc/core": "^1.4.2",
"@swc/helpers": "^0.5.6",
"typescript": "^5.3.3",
"vite": "^5.1.4",
"vite-plugin-node": "^3.1.0",
"fastify": "^4.26.1" // vite.config.ts
import { defineConfig } from "vite";
import { VitePluginNode as vite_plugin_node } from "vite-plugin-node";
export default defineConfig({
plugins: [
...vite_plugin_node({
adapter: "nest",
appPath: "./src/index.ts",
exportName: "App",
tsCompiler: "swc",
initAppOnBoot: true,
}),
],
}); // ./src/index.ts
import { NestFactory } from "@nestjs/core";
import {
FastifyAdapter,
type NestFastifyApplication,
} from "@nestjs/platform-fastify";
import { AppModule } from "./app.module";
import { RawServerDefault } from "fastify";
async function create() {
const adapter = new FastifyAdapter({});
const app: NestFastifyApplication<RawServerDefault> =
await NestFactory.create<NestFastifyApplication>(AppModule, adapter);
return app;
}
export const App = create(); |
It seems that this happens when several requests arrive at one endpoint, for some reason they are processed simultaneously and |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running "vite" as my pnpm dev command. Happens when I edit a route handler.
Seems like fastify has issues with SSR. My old command "nodemon" works fine since it reloads the whole server from scratch.
The text was updated successfully, but these errors were encountered: