lollms-webui/web/vite.config.mjs
2023-07-01 16:57:59 +03:00

39 lines
966 B
JavaScript

import { fileURLToPath, URL } from 'node:url'
import { defineConfig,loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default ({ mode }) => {
// Load app-level env vars to node-level env vars.
process.env = {...process.env, ...loadEnv(mode, process.cwd())};
return defineConfig({
plugins: [
vue()
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
proxy: {
"/api/": {
target: process.env.VITE_GPT4ALL_API,
changeOrigin: process.env.VITE_GPT4ALL_API_CHANGE_ORIGIN,
secure: process.env.VITE_GPT4ALL_API_SECURE,
rewrite: (path) => path.replace(/^\/api/, ""),
},
// "/": {
// target: process.env.VITE_GPT4ALL_API,
// changeOrigin: process.env.VITE_GPT4ALL_API_CHANGE_ORIGIN,
// secure: process.env.VITE_GPT4ALL_API_SECURE,
// },
},
}
})}