云链智安数据大屏
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

vite.config.ts 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import autoprefixer from "autoprefixer"
  5. import postcsspxtorem from "postcss-pxtorem"
  6. export default defineConfig({
  7. base:"./",
  8. plugins:[
  9. vue(),
  10. ],
  11. server: {
  12. proxy: {
  13. '/api': {
  14. target: 'https://esos-iot.bjdexn.cn', // 目标服务器
  15. changeOrigin: true, // 是否改变原始主机头为目标URL
  16. rewrite: (path) => path.replace(/^\/api/, ''), // 重写路径
  17. },
  18. },
  19. },
  20. css: {
  21. postcss: {
  22. plugins: [
  23. autoprefixer({
  24. overrideBrowserslist: [
  25. "Android 4.1",
  26. "iOS 7.1",
  27. "Chrome > 31",
  28. "ff > 31",
  29. "ie >= 8",
  30. "last 10 versions", // 所有主流浏览器最近10版本用
  31. ],
  32. grid: true
  33. }),
  34. postcsspxtorem({
  35. rootValue: 192, // 设计稿宽度的1/ 10 例如设计稿按照 1920设计 此处就为192
  36. propList: ["*", "!border"], // 除 border 外所有px 转 rem
  37. selectorBlackList: [".el-"], // 过滤掉.el-开头的class,不进行rem转换
  38. })
  39. ],
  40. },
  41. },
  42. resolve: {
  43. alias: {
  44. '@': fileURLToPath(new URL('./src', import.meta.url))
  45. },
  46. extensions: ['.ts', '.js', '.vue', '.json'],
  47. }
  48. })