zx_web/vite.config.ts

36 lines
872 B
TypeScript
Raw Normal View History

2025-03-04 16:18:46 +08:00
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import vueDevTools from 'vite-plugin-vue-devtools'
2025-03-14 14:35:43 +08:00
import fs from 'fs';
import path from 'path';
2025-03-04 16:18:46 +08:00
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
vueJsx(),
vueDevTools(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
},
2025-03-14 14:35:43 +08:00
server: {
// ...
host:"0.0.0.0",
https: {
key: fs.readFileSync(path.resolve(__dirname, 'cert/privkey.pem')),
cert: fs.readFileSync(path.resolve(__dirname, 'cert/fullchain.pem')),
},
2025-03-23 15:16:30 +08:00
proxy:{
'/api': {
changeOrigin: true,
target: 'http://192.168.10.176:6001',
rewrite: (path) => path.replace(/^\/api/, '/api')
}
}
2025-03-14 14:35:43 +08:00
},
2025-03-23 15:16:30 +08:00
})