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

60 lines
1.6 KiB
TypeScript
Raw Normal View History

2024-05-19 13:20:42 +00:00
import { defineConfig } from '@vben/vite-config';
export default defineConfig({
2024-06-16 07:45:15 +00:00
application: ({ mode }) => {
return {
2024-06-29 07:41:10 +00:00
compress: false,
compressTypes: ['brotli', 'gzip'] as const,
2024-06-16 07:45:15 +00:00
importmap: false,
importmapOptions: {
// 通过 Importmap CDN 方式引入,
// 目前只有esm.sh源兼容性好一点jspm.io对于 esm 入口要求高
defaultProvider: 'esm.sh',
importmap: [
{ name: 'vue' },
{ name: 'pinia' },
{ name: 'vue-router' },
{ name: 'vue-i18n' },
{ name: 'dayjs' },
{ name: 'vue-demi' },
],
},
pwa: false,
pwaOptions: {
manifest: {
description:
'Vben Admin Pro is a modern admin dashboard template based on Vue 3. ',
icons: [
{
sizes: '192x192',
2024-07-07 15:52:19 +00:00
src: 'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/pwa-icon-192.png',
2024-06-16 07:45:15 +00:00
type: 'image/png',
},
{
sizes: '512x512',
2024-07-07 15:52:19 +00:00
src: 'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/pwa-icon-512.png',
2024-06-16 07:45:15 +00:00
type: 'image/png',
},
],
name: `Vben Admin Pro ${mode}`,
short_name: `Vben Admin Pro ${mode}`,
},
},
visualizer: false,
};
2024-05-19 13:20:42 +00:00
},
vite: {
server: {
proxy: {
2024-06-30 06:09:44 +00:00
'/api': {
2024-05-19 13:20:42 +00:00
changeOrigin: true,
2024-06-30 06:09:44 +00:00
rewrite: (path) => path.replace(/^\/api/, ''),
// 代理目标地址 - backend-mock 项目
target: 'http://localhost:5320/api',
2024-05-19 13:20:42 +00:00
ws: true,
},
},
},
},
});