add ignoreDuringBuilds
This commit is contained in:
@@ -5,6 +5,8 @@ const nextConfig = {
|
|||||||
output: 'standalone',
|
output: 'standalone',
|
||||||
eslint: {
|
eslint: {
|
||||||
dirs: ['src'],
|
dirs: ['src'],
|
||||||
|
// 在生产构建时忽略 ESLint 错误
|
||||||
|
ignoreDuringBuilds: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
reactStrictMode: false,
|
reactStrictMode: false,
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
// Socket.IO 客户端管理
|
// Socket.IO 客户端管理
|
||||||
import { io, Socket } from 'socket.io-client';
|
import type { Socket } from 'socket.io-client';
|
||||||
|
import { io } from 'socket.io-client';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
ServerToClientEvents,
|
|
||||||
ClientToServerEvents,
|
ClientToServerEvents,
|
||||||
|
ServerToClientEvents,
|
||||||
WatchRoomConfig,
|
WatchRoomConfig,
|
||||||
} from '@/types/watch-room';
|
} from '@/types/watch-room';
|
||||||
|
|
||||||
@@ -20,8 +22,8 @@ class WatchRoomSocketManager {
|
|||||||
|
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
||||||
const socketOptions: any = {
|
const socketOptions = {
|
||||||
transports: ['websocket', 'polling'],
|
transports: ['websocket', 'polling'] as ('websocket' | 'polling')[],
|
||||||
reconnection: true,
|
reconnection: true,
|
||||||
reconnectionDelay: 1000,
|
reconnectionDelay: 1000,
|
||||||
reconnectionDelayMax: 5000,
|
reconnectionDelayMax: 5000,
|
||||||
@@ -66,11 +68,15 @@ class WatchRoomSocketManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.socket.on('connect', () => {
|
this.socket.on('connect', () => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log('[WatchRoom] Connected to server');
|
console.log('[WatchRoom] Connected to server');
|
||||||
resolve(this.socket!);
|
if (this.socket) {
|
||||||
|
resolve(this.socket);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.socket.on('connect_error', (error) => {
|
this.socket.on('connect_error', (error) => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error('[WatchRoom] Connection error:', error);
|
console.error('[WatchRoom] Connection error:', error);
|
||||||
reject(error);
|
reject(error);
|
||||||
});
|
});
|
||||||
@@ -101,14 +107,17 @@ class WatchRoomSocketManager {
|
|||||||
if (!this.socket) return;
|
if (!this.socket) return;
|
||||||
|
|
||||||
this.socket.on('connect', () => {
|
this.socket.on('connect', () => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log('[WatchRoom] Socket connected');
|
console.log('[WatchRoom] Socket connected');
|
||||||
});
|
});
|
||||||
|
|
||||||
this.socket.on('disconnect', (reason) => {
|
this.socket.on('disconnect', (reason) => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log('[WatchRoom] Socket disconnected:', reason);
|
console.log('[WatchRoom] Socket disconnected:', reason);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.socket.on('error', (error) => {
|
this.socket.on('error', (error) => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error('[WatchRoom] Socket error:', error);
|
console.error('[WatchRoom] Socket error:', error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user