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