vite.config.ts 844 B

12345678910111213141516171819202122232425262728293031323334
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import path from 'path'
  4. // https://vite.dev/config/
  5. export default defineConfig({
  6. plugins: [ vue() ],
  7. css: {
  8. preprocessorOptions: {
  9. less: {
  10. // additionalData: `@import "@/styles/variables.less";`, // 替换为你的全局样式路径
  11. },
  12. },
  13. },
  14. server:{
  15. port:8080,
  16. host: '0.0.0.0', // 配置项目可以局域网访问
  17. cors: true, // 默认启用并允许任何源
  18. proxy: {
  19. '/alipay-ccm-robot': {
  20. target: 'https://test.hz-hanghui.com:18890',
  21. changeOrigin: true,
  22. rewrite: (path) => path.replace(/^\/api/, ''),
  23. },
  24. },
  25. },
  26. base: './', // 打包的静态资源引用路径
  27. resolve: {
  28. alias: {
  29. find: '@',
  30. replacement: path.resolve(__dirname, 'src')
  31. },
  32. },
  33. })