vite.config.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. const { resolve } = require('path')
  2. import vue from '@vitejs/plugin-vue'
  3. import { defineConfig } from 'vite'
  4. import glsl from 'vite-plugin-glsl'
  5. const vueJsx = require('@vitejs/plugin-vue-jsx')
  6. const legacy = require('@vitejs/plugin-legacy')
  7. const proxyUrl = 'https://test.lexiaoya.cn/' // test 环境
  8. // const proxyUrl = 'http://192.168.3.70:8989/' // test 环境
  9. // const proxyUrl = 'https://online.colexiu.com/' // online 环境
  10. export default defineConfig({
  11. base: '/orchestra-music-score',
  12. build: {
  13. rollupOptions: {
  14. input: {
  15. index: resolve(__dirname, 'index.html'),
  16. orchestra: resolve(__dirname, 'orchestra.html'),
  17. colexiu: resolve(__dirname, 'colexiu.html'),
  18. 'colexiu-report-share': resolve(__dirname, 'colexiu-report-share.html'),
  19. 'colexiu-report': resolve(__dirname, 'colexiu-report.html'),
  20. 'colxiu-website': resolve(__dirname, 'colxiu-website.html'),
  21. 'colxiu-share': resolve(__dirname, 'colexiu-share.html'),
  22. 'music-sheet': resolve(__dirname, 'music-sheet.html'),
  23. },
  24. },
  25. },
  26. plugins: [
  27. vue(),
  28. glsl(),
  29. vueJsx(),
  30. legacy({
  31. targets: ['> 0.25%, not dead'],
  32. ignoreBrowserslistConfig: true,
  33. }),
  34. ],
  35. server: {
  36. port: 3000,
  37. cors: true,
  38. proxy: {
  39. '/api-student': {
  40. target: proxyUrl,
  41. changeOrigin: true,
  42. },
  43. '/api-teacher': {
  44. target: proxyUrl,
  45. changeOrigin: true,
  46. },
  47. '/api-backend': {
  48. target: proxyUrl,
  49. changeOrigin: true,
  50. }
  51. },
  52. },
  53. preview: {
  54. port: 3000,
  55. host: '192.168.3.114'
  56. }
  57. })