vite.config.js 1.5 KB

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