vite.config.ts 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. <<<<<<< HEAD
  15. const proxyUrl = 'https://test.lexiaoya.cn/'
  16. // const proxyUrl = 'https://dev.lexiaoya.cn/'
  17. =======
  18. // const proxyUrl = 'https://test.lexiaoya.cn/'
  19. const proxyUrl = 'https://test.lexiaoya.cn/'
  20. >>>>>>> iteration-oss-up
  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. proxy: {
  59. '/api-oauth': {
  60. target: proxyUrl,
  61. changeOrigin: true
  62. },
  63. '/api-school': {
  64. target: proxyUrl,
  65. changeOrigin: true
  66. },
  67. '/api-teacher': {
  68. target: proxyUrl,
  69. changeOrigin: true
  70. },
  71. '/api-student': {
  72. target: proxyUrl,
  73. changeOrigin: true
  74. },
  75. '/api-backend': {
  76. target: proxyUrl,
  77. changeOrigin: true
  78. }
  79. }
  80. },
  81. build: {
  82. rollupOptions: {
  83. input: {
  84. index: resolve('index.html'),
  85. teacher: resolve('teacher.html'),
  86. school: resolve('school.html')
  87. }
  88. }
  89. // target: 'es2015',
  90. // cssTarget: 'chrome80',
  91. // reportCompressedSize: false,
  92. // chunkSizeWarningLimit: 500,
  93. }
  94. })