vite.config.ts 1.9 KB

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