Files
CA/frontend/vite.config.ts

41 lines
1009 B
TypeScript
Raw Permalink Normal View History

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
optimizeDeps: {
exclude: ['@geoscene/core'],
},
server: {
port: 3000,
allowedHosts: ['alpha.hyh.ink'],
proxy: {
'/api': {
target: 'http://localhost:8000',
changeOrigin: true,
},
// Same-origin Gaode tiles — WebTileLayer needs CORS; direct autonavi URLs fail.
'/basemap-gaode': {
target: 'https://webrd01.is.autonavi.com',
changeOrigin: true,
rewrite: (p) => {
const m = p.match(/^\/basemap-gaode\/(\d+)\/(\d+)\/(\d+)/);
if (!m) return p;
const [, z, x, y] = m;
return `/appmaptile?lang=zh_cn&size=1&scale=1&style=8&z=${z}&x=${x}&y=${y}`;
},
},
},
},
preview: {
port: 3000,
allowedHosts: ['alpha.hyh.ink'],
},
})