vite.config.ts 857 B

123456789101112131415161718192021222324252627282930
  1. import {defineConfig, loadEnv} from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import {resolve} from 'path'
  4. const pathResolve = (dir: string): any => {
  5. return resolve(__dirname, '.', dir)
  6. }
  7. export default defineConfig(mode => {
  8. const env = loadEnv(mode.mode, process.cwd());
  9. const alias: Record<string, string> = {
  10. '/@': pathResolve('./src/'),
  11. "@": pathResolve("./src"),
  12. };
  13. return {
  14. server: {
  15. port: 5173,
  16. strictPort: false,
  17. //proxy: {
  18. // "/api": {
  19. // target: 'http://120.79.56.64:8025',
  20. // rewrite: (path) => path.replace(/^\/api/, '')
  21. // },
  22. //}
  23. },
  24. base: env.VITE_APP_Vitrural,///根据实际情况确定虚拟目录
  25. resolve: {alias},
  26. plugins: [vue()]
  27. };
  28. })