Skip to content

Commit 44431b3

Browse files
authored
fix: restore Node 18 support after security dependency updates (#1495)
1 parent 8f50dff commit 44431b3

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@callstack/repack-dev-server": patch
3+
---
4+
5+
Fix dev server shutdown hanging on Node 18 with fastify 5.12+ by force-closing open connections on stop

‎apps/tester-app/rspack.config.mjs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import path from 'node:path';
22
import * as Repack from '@callstack/repack';
33
import { NativeWindPlugin } from '@callstack/repack-plugin-nativewind';
44
import { ReanimatedPlugin } from '@callstack/repack-plugin-reanimated';
5-
import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin';
5+
6+
// Rsdoctor (through rslog) throws on import under Node < 20, so only load it
7+
// when it's actually enabled to keep the Node 18 test matrix working.
8+
const { RsdoctorRspackPlugin } = process.env.RSDOCTOR
9+
? await import('@rsdoctor/rspack-plugin')
10+
: {};
611

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

‎packages/dev-server/src/createServer.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ export async function createServer(config: Server.Config) {
2828

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

0 commit comments

Comments
 (0)