feat: 提交
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { defineConfig } from 'vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
|
||||
function resolveBuildId() {
|
||||
const configured = process.env.BUILD_ID?.trim().replace(/[^a-zA-Z0-9_-]/g, '')
|
||||
@@ -9,9 +9,13 @@ function resolveBuildId() {
|
||||
}
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig(() => {
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
const buildId = resolveBuildId()
|
||||
const apiProxyTarget = process.env.VITE_API_PROXY_TARGET?.trim() || 'https://ipad.shenynet.com'
|
||||
const apiProxyTarget =
|
||||
process.env.VITE_API_PROXY_TARGET?.trim() ||
|
||||
env.VITE_API_PROXY_TARGET?.trim() ||
|
||||
'http://127.0.0.1:18080'
|
||||
|
||||
return {
|
||||
plugins: [vue()],
|
||||
@@ -25,6 +29,9 @@ export default defineConfig(() => {
|
||||
},
|
||||
},
|
||||
server: {
|
||||
// The public HTTPS virtual host terminates TLS in Nginx and proxies to this dev server.
|
||||
// Permit only that configured hostname; keep Vite's DNS-rebinding protection enabled.
|
||||
allowedHosts: ['fn.xianyi.de'],
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: apiProxyTarget,
|
||||
|
||||
Reference in New Issue
Block a user