Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/dev-server-node18-close.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@callstack/repack-dev-server": patch
---

Fix dev server shutdown hanging on Node 18 with fastify 5.12+ by force-closing open connections on stop
7 changes: 6 additions & 1 deletion apps/tester-app/rspack.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import path from 'node:path';
import * as Repack from '@callstack/repack';
import { NativeWindPlugin } from '@callstack/repack-plugin-nativewind';
import { ReanimatedPlugin } from '@callstack/repack-plugin-reanimated';
import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin';

// Rsdoctor (through rslog) throws on import under Node < 20, so only load it
// when it's actually enabled to keep the Node 18 test matrix working.
const { RsdoctorRspackPlugin } = process.env.RSDOCTOR
? await import('@rsdoctor/rspack-plugin')
: {};

const dirname = Repack.getDirname(import.meta.url);

Expand Down
4 changes: 4 additions & 0 deletions packages/dev-server/src/createServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export async function createServer(config: Server.Config) {

/** Fastify instance powering the development server. */
const instance = Fastify({
// Since fastify 5.12 the default ('idle') leaves idle keep-alive sockets
// to `server.close()`, which only closes them on Node 19+. Force-closing
// keeps `stop()` from hanging on Node 18.
forceCloseConnections: true,
disableRequestLogging: options.disableRequestLogging,
logger: {
level: 'trace',
Expand Down
Loading