File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -190,9 +190,16 @@ export class SessionStore {
190190 */
191191 startCleanupInterval ( ) {
192192 // Clean up every hour
193+ // Use unref() to prevent this interval from keeping the process alive during build
193194 this . cleanupInterval = setInterval ( ( ) => {
194195 this . cleanupExpiredSessions ( ) ;
195196 } , 60 * 60 * 1000 ) ;
197+
198+ // Allow Node.js to exit even if this interval is still active
199+ // This is especially important during build processes
200+ if ( this . cleanupInterval . unref ) {
201+ this . cleanupInterval . unref ( ) ;
202+ }
196203 }
197204
198205 /**
Original file line number Diff line number Diff line change 11import { sveltekit } from '@sveltejs/kit/vite' ;
22import { defineConfig } from 'vite' ;
33
4- import { Server } from 'socket.io' ;
5- import { createPortalServer } from './src/lib/server/PortalServer.js' ;
6-
74const webSocketServer = {
85 name : 'webSocketServer' ,
9- configureServer ( server ) {
6+ async configureServer ( server ) {
107 if ( ! server . httpServer || process . env . NODE_ENV == 'production' ) return ;
118
9+ // Dynamic import - only load when actually needed
10+ const { Server } = await import ( 'socket.io' ) ;
11+ const { createPortalServer } = await import ( './src/lib/server/PortalServer.js' ) ;
12+
1213 // Get allowed origins from environment variable or use localhost defaults
1314 const allowedOrigins = process . env . ALLOWED_ORIGINS
1415 ? process . env . ALLOWED_ORIGINS . split ( ',' ) . map ( origin => origin . trim ( ) )
You can’t perform that action at this time.
0 commit comments