vite.config.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import styleImport from 'vite-plugin-style-import'
  4. import vueJsx from '@vitejs/plugin-vue-jsx'
  5. import legacy from '@vitejs/plugin-legacy'
  6. // eslint-disable-next-line @typescript-eslint/no-var-requires
  7. const path = require('path')
  8. function resolve(dir: string) {
  9. return path.join(__dirname, dir)
  10. }
  11. // https://vitejs.dev/config/
  12. // https://github.com/vitejs/vite/issues/1930 .env
  13. <<<<<<< HEAD
  14. // const proxyUrl = 'https://online.lexiaoya.cn/';
  15. const proxyUrl = 'https://test.lexiaoya.cn/'
  16. =======
  17. // const proxyUrl = 'https://online.lexiaoya.cn/'
  18. // const proxyUrl = 'https://test.lexiaoya.cn/'
  19. const proxyUrl = 'https://dev.lexiaoya.cn/'
  20. >>>>>>> online
  21. // const proxyUrl = 'http://47.98.131.38:8989/'
  22. // const proxyUrl = 'http://192.168.3.20:8989/' // 邹旋
  23. // const proxyUrl = 'http://192.168.3.143:8989/' // 尚科
  24. // const proxyUrl = 'http://192.168.3.26:8989/' // 刘俊驰
  25. export default defineConfig({
  26. base: './',
  27. plugins: [
  28. vue(),
  29. vueJsx(),
  30. legacy({
  31. targets: ['> 0.25%, not dead'],
  32. ignoreBrowserslistConfig: true
  33. })
  34. // styleImport({
  35. // libs: [
  36. // {
  37. // libraryName: 'vant',
  38. // esModule: true,
  39. // resolveStyle: name => `../../vant/es/${name}/style`
  40. // }
  41. // ]
  42. // })
  43. ],
  44. resolve: {
  45. alias: {
  46. '@': resolve('./src'),
  47. '@common': resolve('./src/common'),
  48. '@components': resolve('./src/components'),
  49. '@store': resolve('./src/store'),
  50. '@views': resolve('./src/views')
  51. }
  52. },
  53. server: {
  54. host: '0.0.0.0',
  55. port: 1000,
  56. strictPort: true,
  57. cors: true,
  58. // https: true,
  59. proxy: {
  60. '/api-oauth': {
  61. target: proxyUrl,
  62. changeOrigin: true
  63. },
  64. '/api-school': {
  65. target: proxyUrl,
  66. changeOrigin: true
  67. },
  68. '/api-teacher': {
  69. target: proxyUrl,
  70. changeOrigin: true
  71. },
  72. '/api-student': {
  73. target: proxyUrl,
  74. changeOrigin: true
  75. },
  76. '/api-backend': {
  77. target: proxyUrl,
  78. changeOrigin: true
  79. }
  80. }
  81. },
  82. build: {
  83. rollupOptions: {
  84. input: {
  85. index: resolve('index.html'),
  86. teacher: resolve('teacher.html'),
  87. school: resolve('school.html')
  88. }
  89. }
  90. // target: 'es2015',
  91. // cssTarget: 'chrome80',
  92. // reportCompressedSize: false,
  93. // chunkSizeWarningLimit: 500,
  94. }
  95. })