goldenChat base source add
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import { defineConfig, createLogger } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
|
||||
// WebSocket proxy 재연결/종료 시 발생하는 ECONNRESET·EPIPE 는 정상 TCP 이벤트이므로 로그 억제
|
||||
const SUPPRESS = ['ECONNRESET', 'EPIPE', 'ws proxy socket error'];
|
||||
const logger = createLogger();
|
||||
const _origError = logger.error.bind(logger);
|
||||
logger.error = (msg, opts) => {
|
||||
if (SUPPRESS.some(s => msg.includes(s))) return;
|
||||
_origError(msg, opts);
|
||||
};
|
||||
|
||||
export default defineConfig({
|
||||
customLogger: logger,
|
||||
plugins: [react()],
|
||||
resolve: {
|
||||
dedupe: ['lightweight-charts'],
|
||||
},
|
||||
optimizeDeps: {
|
||||
include: ['react', 'react-dom'],
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
// ── GoldenChart Backend API 프록시 ───────────────────────────
|
||||
'/api': {
|
||||
target: 'http://localhost:8080',
|
||||
changeOrigin: true,
|
||||
ws: true, // STOMP SockJS (/api/ws/trading)
|
||||
},
|
||||
|
||||
// ── REST API 프록시 (CORS 우회) ──────────────────────────────
|
||||
'/upbit-api': {
|
||||
target: 'https://api.upbit.com',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/upbit-api/, ''),
|
||||
headers: { Accept: 'application/json' },
|
||||
},
|
||||
|
||||
// ── WebSocket 프록시 (Origin 차단 우회) ──────────────────────
|
||||
// 브라우저 → ws://localhost:PORT/upbit-ws → wss://api.upbit.com/websocket/v1
|
||||
'/upbit-ws': {
|
||||
target: 'wss://api.upbit.com',
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
rewrite: () => '/websocket/v1',
|
||||
// ECONNRESET 은 Upbit 서버가 연결을 정상 종료할 때 발생하는 TCP 이벤트
|
||||
// (페이지 새로고침/재연결 시 정상 현상) → 로그 억제
|
||||
configure: (proxy) => {
|
||||
proxy.on('error', (err: Error & { code?: string }) => {
|
||||
if (err.code === 'ECONNRESET' || err.code === 'EPIPE') return; // 정상 종료 → 무시
|
||||
console.error('[upbit-ws proxy]', err.message);
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user