unwind/unwind-ui/vite.config.ts

30 lines
696 B
TypeScript
Raw Permalink Normal View History

2021-08-05 17:50:44 +02:00
import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
2021-07-25 19:01:25 +02:00
// Vite defaults.
const vite_host = "localhost"
const vite_port = 3000
const base = process.env.BASE_URL || "/"
const proxied_api_url = `http://${vite_host}:${vite_port}/api/`
const real_api_url = `http://${process.env.API_HOST}:${process.env.API_PORT}/api/`
2021-07-25 19:01:25 +02:00
// https://vitejs.dev/config/
export default defineConfig({
base,
define: {
"process.env.API_URL": JSON.stringify(process.env.API_URL || proxied_api_url),
},
server: {
host: vite_host,
port: vite_port,
proxy: {
[`${base}api`]: {
target: real_api_url,
prependPath: false,
},
},
},
plugins: [vue()],
2021-07-25 19:01:25 +02:00
})