mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
🌐 feat: Configurable Domain and Port for Vite Dev Server (#10180)
This commit is contained in:
parent
d8d5d59d92
commit
87d7ee4b0e
1 changed files with 10 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
|
// @ts-ignore
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import type { Plugin } from 'vite';
|
import type { Plugin } from 'vite';
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
|
|
@ -7,19 +8,23 @@ import { nodePolyfills } from 'vite-plugin-node-polyfills';
|
||||||
import { VitePWA } from 'vite-plugin-pwa';
|
import { VitePWA } from 'vite-plugin-pwa';
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
|
const backendPort = process.env.BACKEND_PORT && Number(process.env.BACKEND_PORT) || 3080;
|
||||||
|
const backendURL = process.env.HOST ? `http://${process.env.HOST}:${backendPort}` : `http://localhost:${backendPort}`;
|
||||||
|
|
||||||
export default defineConfig(({ command }) => ({
|
export default defineConfig(({ command }) => ({
|
||||||
base: '',
|
base: '',
|
||||||
server: {
|
server: {
|
||||||
host: 'localhost',
|
allowedHosts: process.env.VITE_ALLOWED_HOSTS && process.env.VITE_ALLOWED_HOSTS.split(',') || [],
|
||||||
port: 3090,
|
host: process.env.HOST || 'localhost',
|
||||||
|
port: process.env.PORT && Number(process.env.PORT) || 3090,
|
||||||
strictPort: false,
|
strictPort: false,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://localhost:3080',
|
target: backendURL,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/oauth': {
|
'/oauth': {
|
||||||
target: 'http://localhost:3080',
|
target: backendURL,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -259,6 +264,7 @@ export default defineConfig(({ command }) => ({
|
||||||
interface SourcemapExclude {
|
interface SourcemapExclude {
|
||||||
excludeNodeModules?: boolean;
|
excludeNodeModules?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sourcemapExclude(opts?: SourcemapExclude): Plugin {
|
export function sourcemapExclude(opts?: SourcemapExclude): Plugin {
|
||||||
return {
|
return {
|
||||||
name: 'sourcemap-exclude',
|
name: 'sourcemap-exclude',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue