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
|
|
|
|
2023-11-26 19:43:56 +01: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({
|
2023-11-26 19:43:56 +01:00
|
|
|
base,
|
2021-08-05 19:18:51 +02:00
|
|
|
define: {
|
2023-11-26 19:43:56 +01:00
|
|
|
"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,
|
|
|
|
|
},
|
|
|
|
|
},
|
2021-08-05 19:18:51 +02:00
|
|
|
},
|
|
|
|
|
plugins: [vue()],
|
2021-07-25 19:01:25 +02:00
|
|
|
})
|