A8000
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.1 KiB

8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
8 months ago
7 months ago
8 months ago
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import { fileURLToPath, URL } from 'url'
  4. import AutoImport from 'unplugin-auto-import/vite'
  5. import Components from 'unplugin-vue-components/vite'
  6. import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
  7. // https://vitejs.dev/config/
  8. export default defineConfig({
  9. base: './',
  10. plugins: [
  11. vue(),
  12. AutoImport({
  13. resolvers: [ElementPlusResolver({ importStyle: false })],
  14. }),
  15. Components({
  16. resolvers: [ElementPlusResolver({ importStyle: false })],
  17. }),
  18. ],
  19. resolve: {
  20. extensions: ['.js', '.ts', '.vue', '.json'], // 添加 .ts 扩展名解析
  21. alias: {
  22. '@': fileURLToPath(new URL('./src', import.meta.url)), // 确保将 @ 指向 src 目录
  23. },
  24. },
  25. build: {
  26. minify: 'terser',
  27. terserOptions: {
  28. compress: {
  29. drop_console: true,
  30. drop_debugger: true,
  31. },
  32. },
  33. },
  34. server: {
  35. proxy: {
  36. '/api': {
  37. target: 'http://localhost',
  38. changeOrigin: true,
  39. // rewrite: (path) => path.replace(/^\/api/, ''),
  40. },
  41. },
  42. },
  43. })