50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const frontendRoot = path.resolve(__dirname, '../frontend/src');
|
|
const sharedRoot = path.resolve(__dirname, '../packages/shared/src');
|
|
|
|
export default defineConfig({
|
|
envDir: __dirname,
|
|
plugins: [react()],
|
|
resolve: {
|
|
dedupe: ['react', 'react-dom', 'lightweight-charts'],
|
|
alias: {
|
|
'@goldenchart/shared': sharedRoot,
|
|
'@frontend': frontendRoot,
|
|
[path.resolve(frontendRoot, 'utils/backendApi.ts')]: path.resolve(sharedRoot, 'api/backendApi.ts'),
|
|
},
|
|
},
|
|
optimizeDeps: {
|
|
include: ['react', 'react-dom', '@stomp/stompjs', 'sockjs-client'],
|
|
},
|
|
server: {
|
|
port: 5174,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8080',
|
|
changeOrigin: true,
|
|
ws: true,
|
|
},
|
|
'/upbit-api': {
|
|
target: 'https://api.upbit.com',
|
|
changeOrigin: true,
|
|
rewrite: p => p.replace(/^\/upbit-api/, ''),
|
|
},
|
|
'/upbit-ws': {
|
|
target: 'wss://api.upbit.com',
|
|
changeOrigin: true,
|
|
ws: true,
|
|
rewrite: () => '/websocket/v1',
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
sourcemap: true,
|
|
},
|
|
});
|