tianji/src/client/vite.config.ts
2024-08-03 00:04:54 +08:00

49 lines
1.0 KiB
TypeScript

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
import { TanStackRouterVite } from '@tanstack/router-vite-plugin';
// https://vitejs.dev/config/
export default defineConfig({
root: __dirname,
plugins: [
react(),
// @ts-ignore
TanStackRouterVite({
routesDirectory: './routes',
generatedRouteTree: './routeTree.gen.ts',
}),
],
build: {
outDir: '../server/public',
},
resolve: {
alias: {
'@': resolve(__dirname, './'),
},
},
clearScreen: false,
server: {
// host: '0.0.0.0',
proxy: {
'/socket.io': {
target: 'ws://localhost:12345',
changeOrigin: true,
ws: true,
},
'/trpc': {
target: 'http://localhost:12345',
},
'/api/auth/': {
target: 'http://localhost:12345',
},
'/api/workspace': {
target: 'http://localhost:12345',
},
'/api/website/send': {
target: 'http://localhost:12345',
},
},
},
});