vites.config.js 931 B

123456789101112131415161718192021222324252627282930313233
  1. import {
  2. defineConfig
  3. } from 'vite'
  4. import uni from '@dcloudio/vite-plugin-uni'
  5. // import path from 'path'
  6. const define = {}
  7. if (!["mp-weixin", "h5", "web"].includes(process.env.UNI_PLATFORM)) {
  8. define['global'] = null
  9. define['wx'] = 'uni'
  10. }
  11. export default defineConfig({
  12. // resolve: {
  13. // alias: {
  14. // 'l-echarts': '@/uni_modules/l-echarts/components/l-echarts/l-echarts.vue'
  15. // }
  16. // },
  17. plugins: [uni()],
  18. define,
  19. // base: process.env.NODE_ENV === 'production' ? './' : '/',
  20. // transpileDependencies: ['@dcloudio/uni-ui'],
  21. server: {
  22. port: 8088,
  23. proxy: {
  24. '/api': {
  25. target: 'https://dev3.k12100.net/teaching/api/', // 目标后端服务器地址
  26. // target: 'https://www.k12100.com/teaching/api/',
  27. changeOrigin: true, // 是否改变源
  28. // rewrite: (path) => path.replace(/^\/api/, '/') // 重写路径
  29. rewrite: (path) => path.endsWith('.js') ? '' : path.replace(/^\/api/, '/')
  30. }
  31. }
  32. }
  33. })