admin-vben/apps/web-antd/vite.config.mts

35 lines
782 B
TypeScript
Raw Normal View History

import {
defaultImportmapOptions,
defineConfig,
getDefaultPwaOptions,
loadAndConvertEnv,
} from '@vben/vite-config';
2024-05-19 13:20:42 +00:00
export default defineConfig(async () => {
const { appTitle, base, port, ...envConfig } = await loadAndConvertEnv();
return {
application: {
...envConfig,
2024-06-16 07:45:15 +00:00
importmap: false,
importmapOptions: defaultImportmapOptions,
2024-06-16 07:45:15 +00:00
pwa: false,
pwaOptions: getDefaultPwaOptions(appTitle),
},
vite: {
base,
server: {
port,
proxy: {
'/api': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
// mock代理目标地址
target: 'http://localhost:5320/api',
ws: true,
},
2024-05-19 13:20:42 +00:00
},
},
},
};
2024-05-19 13:20:42 +00:00
});