-
Notifications
You must be signed in to change notification settings - Fork 13
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
dev server cannot be closed #18
Comments
Thanks for reporting. Maybe it's a macOS issue. I'll check on a mac and try to see what's going on. |
it’s worth noting that it appears to work perfectly— the terminal closes with no issues— when I use Express instead of Fastify. |
Getting this with nestjs + fastify as well, created a project using With the stock express-based setup everything worked as expected but when I tried using the fastify adapter I ran into the same issue - trying to terminate the dev server makes the process freeze and spikes its cpu usage. Here's my /// <reference types="vite/client" />
import { NestFactory } from '@nestjs/core';
import httpDevServer from 'vavite/http-dev-server';
import { AppModule } from './app.module';
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
import type { FastifyServerFactory, RawServerDefault } from 'fastify';
import type { AddressInfo } from 'node:net';
bootstrap();
async function bootstrap() {
const app = await NestFactory.create<NestFastifyApplication>(
AppModule,
new FastifyAdapter(
import.meta.env.DEV
? {
serverFactory: (handler => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
httpDevServer!.on('request', handler);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return httpDevServer!;
}) as FastifyServerFactory<RawServerDefault>,
}
: undefined,
),
);
if (import.meta.env.PROD) {
const port = process.env.PORT ?? 3000;
app.listen(port);
} else {
try {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
await app.listen((httpDevServer!.address() as AddressInfo).port);
} catch (e) {
console.error(e);
process.exit(1);
}
}
} EDIT: after letting the server run for a couple of minutes and then trying to ctrl-c it I got this warning in the terminal, no idea if it's of any relevance:
|
I updated all examples to use
Until then I'm unable to solve this, unfortunately. I'll keep it open as a reminder though :) |
This has been solved for sometime, alla examples are now working. |
I am using a React SSR Fastify server with Vavite. When I close the dev server (for example, using Ctrl+C on macOS), the terminal window fails to close. When you try to close it with Ctrl+C, the dev server ceases to work, but continues to show text & does not return control to the user.
This is actually evident even in the Fastify Stackblitz example using the current version of Vite & Vavite.
Can you take a look at this?
The text was updated successfully, but these errors were encountered: