mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-26 11:38:39 +00:00
- Add `server` configuration in `vite.config.ts` - Enable `host: 0.0.0.0` for external access - Setup proxy for `/api`, `/mj`, and `/pg` endpoints targeting `http://localhost:3000`
40 lines
827 B
TypeScript
40 lines
827 B
TypeScript
import path from 'path'
|
|
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react-swc'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import { tanstackRouter } from '@tanstack/router-plugin/vite'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
tanstackRouter({
|
|
target: 'react',
|
|
autoCodeSplitting: true,
|
|
}),
|
|
react(),
|
|
tailwindcss(),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:3000',
|
|
changeOrigin: true,
|
|
},
|
|
'/mj': {
|
|
target: 'http://localhost:3000',
|
|
changeOrigin: true,
|
|
},
|
|
'/pg': {
|
|
target: 'http://localhost:3000',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
})
|