From 7a2f304888c58f61cfd0a918ae9ea573a8d729ba Mon Sep 17 00:00:00 2001
From: alex <alex@alexloehr.net>
Date: Thu, 19 Jun 2025 14:43:01 +0000
Subject: [PATCH] GS-2156
---
vite.config.js | 54 +++++++++++++++++++++++++++++++++---------------------
1 files changed, 33 insertions(+), 21 deletions(-)
diff --git a/vite.config.js b/vite.config.js
index cacf4c1..d201550 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -1,29 +1,41 @@
-import { fileURLToPath, URL } from 'node:url'
+import {fileURLToPath, URL} from 'node:url'
import * as path from 'node:path'
-import { defineConfig } from 'vite'
+import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
+import dotenv from 'dotenv'
+
+
+let envPath = path.resolve(process.cwd(), "vue", '.env')
+if (process.env.VITE_ENV == 'production') {
+ envPath += ".production"
+}
+console.log("> envPath", envPath)
+dotenv.config({path: envPath})
+const routerBase = `${process.env.VITE_ROUTER_BASE}/ui`
+console.log("+ ROUTER BASE IS", routerBase)
// https://vite.dev/config/
export default defineConfig({
- base: "/ui",
- root: path.join(__dirname, 'vue'),
- plugins: [
- vue(),
- vueDevTools(),
- ],
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- },
- },
- server: {
- proxy: {
- '/api': {
- target: 'http://localhost:4101',
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/api/, ''),
+ base: routerBase,
+ root: path.join(__dirname, 'vue'),
+ // publicDir: path.join(__dirname, 'public'),
+ plugins: [
+ vue(),
+ vueDevTools(),
+ ],
+ resolve: {
+ alias: {
+ '@': fileURLToPath(new URL('./vue/src', import.meta.url))
},
- },
- },
+ },
+ server: {
+ proxy: {
+ '/api': {
+ target: 'http://localhost:4101',
+ changeOrigin: true,
+ // rewrite: (path) => path.replace(/^\/api/, ''),
+ },
+ },
+ },
})
--
Gitblit v1.8.0