vite.config.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. // const proxyUrl = 'https://online.lexiaoya.cn/';
  14. const proxyUrl = 'https://test.lexiaoya.cn/';
  15. // const proxyUrl = 'http://47.98.131.38:8989/'
  16. // const proxyUrl = 'http://192.168.3.20:8989/' // 邹旋
  17. // const proxyUrl = 'http://192.168.3.143:8989/' // 尚科
  18. // const proxyUrl = 'http://192.168.3.26:8989/' // 刘俊驰
  19. export default defineConfig({
  20. base: './',
  21. plugins: [
  22. vue(),
  23. vueJsx(),
  24. legacy({
  25. targets: ['> 0.25%, not dead'],
  26. ignoreBrowserslistConfig: true
  27. })
  28. // styleImport({
  29. // libs: [
  30. // {
  31. // libraryName: 'vant',
  32. // esModule: true,
  33. // resolveStyle: name => `../../vant/es/${name}/style`
  34. // }
  35. // ]
  36. // })
  37. ],
  38. resolve: {
  39. alias: {
  40. '@': resolve('./src'),
  41. '@common': resolve('./src/common'),
  42. '@components': resolve('./src/components'),
  43. '@store': resolve('./src/store'),
  44. '@views': resolve('./src/views')
  45. }
  46. },
  47. server: {
  48. host: '0.0.0.0',
  49. port: 1000,
  50. strictPort: true,
  51. cors: true,
  52. proxy: {
  53. '/api-oauth': {
  54. target: proxyUrl,
  55. changeOrigin: true
  56. },
  57. '/api-school': {
  58. target: proxyUrl,
  59. changeOrigin: true
  60. },
  61. '/api-teacher': {
  62. target: proxyUrl,
  63. changeOrigin: true
  64. },
  65. '/api-student': {
  66. target: proxyUrl,
  67. changeOrigin: true
  68. },
  69. '/api-backend': {
  70. target: proxyUrl,
  71. changeOrigin: true
  72. }
  73. }
  74. },
  75. build: {
  76. rollupOptions: {
  77. input: {
  78. index: resolve('index.html'),
  79. teacher: resolve('teacher.html'),
  80. school: resolve('school.html')
  81. }
  82. }
  83. // target: 'es2015',
  84. // cssTarget: 'chrome80',
  85. // reportCompressedSize: false,
  86. // chunkSizeWarningLimit: 500,
  87. }
  88. })