|
@@ -2,6 +2,9 @@ import { defineConfig } from 'vite'
|
|
|
import react from '@vitejs/plugin-react'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
|
|
|
|
// 后端运行在 8080,前端开发期通过代理避免跨域
|
|
// 后端运行在 8080,前端开发期通过代理避免跨域
|
|
|
|
|
+// const PROXY_TARGET = 'http://localhost:8080'
|
|
|
|
|
+const PROXY_TARGET = 'https://api-internal.piaoquantv.com'
|
|
|
|
|
+
|
|
|
export default defineConfig({
|
|
export default defineConfig({
|
|
|
plugins: [react()],
|
|
plugins: [react()],
|
|
|
base: '/content-similarity-recall/', // CDN 部署路径
|
|
base: '/content-similarity-recall/', // CDN 部署路径
|
|
@@ -10,8 +13,7 @@ export default defineConfig({
|
|
|
host: true,
|
|
host: true,
|
|
|
proxy: {
|
|
proxy: {
|
|
|
'/videoVector': {
|
|
'/videoVector': {
|
|
|
- target: 'https://api-internal.piaoquantv.com',
|
|
|
|
|
- // target: 'http://localhost:8080',
|
|
|
|
|
|
|
+ target: PROXY_TARGET,
|
|
|
changeOrigin: true,
|
|
changeOrigin: true,
|
|
|
secure: false,
|
|
secure: false,
|
|
|
configure: (proxy) => {
|
|
configure: (proxy) => {
|
|
@@ -20,6 +22,7 @@ export default defineConfig({
|
|
|
const inner = (err as any)?.errors
|
|
const inner = (err as any)?.errors
|
|
|
// eslint-disable-next-line no-console
|
|
// eslint-disable-next-line no-console
|
|
|
console.error('[proxy error]', req?.method, req?.url,
|
|
console.error('[proxy error]', req?.method, req?.url,
|
|
|
|
|
+ '\n host:', PROXY_TARGET,
|
|
|
'\n name:', err?.name,
|
|
'\n name:', err?.name,
|
|
|
'\n code:', (err as any)?.code,
|
|
'\n code:', (err as any)?.code,
|
|
|
'\n msg:', err?.message,
|
|
'\n msg:', err?.message,
|
|
@@ -29,7 +32,7 @@ export default defineConfig({
|
|
|
})
|
|
})
|
|
|
proxy.on('proxyReq', (_pReq, req) => {
|
|
proxy.on('proxyReq', (_pReq, req) => {
|
|
|
// eslint-disable-next-line no-console
|
|
// eslint-disable-next-line no-console
|
|
|
- console.log('[proxy req]', req?.method, req?.url)
|
|
|
|
|
|
|
+ console.log('[proxy req]', req?.method, req?.url, '→', PROXY_TARGET)
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|