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.

48 lines
1.2 KiB

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