vite.config.js 664 B

123456789101112131415161718192021222324252627282930313233
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import path from 'path'
  4. export default defineConfig({
  5. plugins: [
  6. vue()
  7. ],
  8. resolve: {
  9. alias: {
  10. '@': path.resolve(__dirname, 'src')
  11. }
  12. },
  13. // lru-cache@11 的 ESM 入口含顶层 await;默认 es2020 目标会在预构建/最终转译阶段报错
  14. build: {
  15. target: 'es2022'
  16. },
  17. optimizeDeps: {
  18. esbuildOptions: {
  19. target: 'es2022'
  20. }
  21. },
  22. server: {
  23. host: true,
  24. proxy: {
  25. '/cloud': {
  26. target: 'https://xxoo365.top/cloud',
  27. changeOrigin: true,
  28. rewrite: path => path.replace(/^\/cloud/, '')
  29. }
  30. }
  31. }
  32. })