vite.config.mts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { defineConfig } from '@vben/vite-config';
  2. // 自行取消注释来启用按需导入功能
  3. // import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
  4. // import Components from 'unplugin-vue-components/vite';
  5. export default defineConfig(async () => {
  6. return {
  7. application: {},
  8. vite: {
  9. plugins: [
  10. // Components({
  11. // dirs: [], // 默认会导入src/components目录下所有组件 不需要
  12. // dts: './types/components.d.ts', // 输出类型文件
  13. // resolvers: [
  14. // AntDesignVueResolver({
  15. // // 需要排除Button组件 全局已经默认导入了
  16. // exclude: ['Button'],
  17. // importStyle: false, // css in js
  18. // }),
  19. // ],
  20. // }),
  21. ],
  22. server: {
  23. proxy: {
  24. '/api': {
  25. changeOrigin: true,
  26. rewrite: (path) => path.replace(/^\/api/, ''),
  27. // mock代理目标地址
  28. target: 'http://localhost:6039',
  29. ws: true,
  30. },
  31. },
  32. },
  33. },
  34. };
  35. });