| 123456789101112131415161718192021222324252627282930313233 |
- import { defineConfig } from 'vite';
- import react from '@vitejs/plugin-react';
- // 后端运行在 8080,前端开发期通过代理避免跨域
- export default defineConfig({
- plugins: [react()],
- base: '/content-similarity-recall/', // CDN 部署路径
- server: {
- port: 5173,
- host: true,
- proxy: {
- '/videoVector': {
- target: 'https://api-internal.piaoquantv.com',
- // target: 'http://localhost:8080',
- changeOrigin: true,
- secure: false,
- configure: function (proxy) {
- proxy.on('error', function (err, req) {
- // 把 AggregateError.errors 全部展开, 看每个 IP 的真实失败原因
- var inner = err === null || err === void 0 ? void 0 : err.errors;
- // eslint-disable-next-line no-console
- console.error('[proxy error]', req === null || req === void 0 ? void 0 : req.method, req === null || req === void 0 ? void 0 : req.url, '\n name:', err === null || err === void 0 ? void 0 : err.name, '\n code:', err === null || err === void 0 ? void 0 : err.code, '\n msg:', err === null || err === void 0 ? void 0 : err.message, '\n inner:', Array.isArray(inner)
- ? inner.map(function (e) { return "".concat(e === null || e === void 0 ? void 0 : e.code, "@").concat(e === null || e === void 0 ? void 0 : e.address, ":").concat(e === null || e === void 0 ? void 0 : e.port, " ").concat(e === null || e === void 0 ? void 0 : e.message); }).join(' | ')
- : 'none');
- });
- proxy.on('proxyReq', function (_pReq, req) {
- // eslint-disable-next-line no-console
- console.log('[proxy req]', req === null || req === void 0 ? void 0 : req.method, req === null || req === void 0 ? void 0 : req.url);
- });
- },
- },
- },
- },
- });
|