vite.config.ts 801 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import AutoImport from 'unplugin-auto-import/vite'
  4. const path = require("path");
  5. // https://vitejs.dev/config/
  6. export default defineConfig({
  7. plugins: [vue(),
  8. AutoImport({
  9. imports: ['vue', {
  10. '@/utils/cope': [
  11. // named imports
  12. 'copeResponse', // import { useMouse } from '@vueuse/core',
  13. ]
  14. }],
  15. dts: true
  16. })],
  17. resolve: {
  18. alias: {
  19. '@': path.resolve(__dirname, './src')
  20. },
  21. },
  22. server: {
  23. proxy: {
  24. '/api': {
  25. target: 'http://127.0.0.1:4523/mock/859582',
  26. changeOrigin: true,
  27. rewrite: path => path.replace(/^\/api/, ''),
  28. }
  29. },
  30. watch: {
  31. usePolling: true
  32. }
  33. }
  34. })