Refactored frontend directory
Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Failing after 2m46s
Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Failing after 2m46s
This commit is contained in:
39
frontend/vite.config.ts
Normal file
39
frontend/vite.config.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import fs from 'fs'
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
const backendHost = env.VITE_BACKEND_HOST ?? '127.0.0.1'
|
||||
|
||||
const httpsConfig =
|
||||
fs.existsSync('./key.pem') && fs.existsSync('./cert.pem')
|
||||
? { key: fs.readFileSync('./key.pem'), cert: fs.readFileSync('./cert.pem') }
|
||||
: undefined
|
||||
|
||||
return {
|
||||
plugins: [vue()],
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
https: httpsConfig,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: `http://${backendHost}:5000`,
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
},
|
||||
'/events': {
|
||||
target: 'http://192.168.1.102:5000',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user