vite.config.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. const { resolve } = require('path')
  2. import vue from '@vitejs/plugin-vue'
  3. import { defineConfig } from 'vite'
  4. import { VitePWA } from 'vite-plugin-pwa'
  5. import glsl from 'vite-plugin-glsl'
  6. import styleImport from 'vite-plugin-style-import'
  7. const vueJsx = require('@vitejs/plugin-vue-jsx')
  8. const legacy = require('@vitejs/plugin-legacy')
  9. const proxyUrl = 'http://47.98.131.38:8989/' // test 环境
  10. // const proxyUrl = 'https://online.colexiu.com/' // online 环境
  11. // const proxyUrl = 'http://mstudev.dayaedu.com'
  12. export default defineConfig({
  13. base: '/orchestra-music-score',
  14. build: {
  15. rollupOptions: {
  16. input: {
  17. index: resolve(__dirname, 'index.html'),
  18. colexiu: resolve(__dirname, 'colexiu.html'),
  19. 'colexiu-report-share': resolve(__dirname, 'colexiu-report-share.html'),
  20. 'colexiu-report': resolve(__dirname, 'colexiu-report.html'),
  21. 'colxiu-website': resolve(__dirname, 'colxiu-website.html'),
  22. 'colxiu-share': resolve(__dirname, 'colexiu-share.html'),
  23. 'music-sheet': resolve(__dirname, 'music-sheet.html'),
  24. },
  25. },
  26. },
  27. plugins: [
  28. vue(),
  29. glsl(),
  30. vueJsx(),
  31. legacy({
  32. targets: ['> 0.25%, not dead'],
  33. ignoreBrowserslistConfig: true,
  34. }),
  35. // styleImport({
  36. // libs: [
  37. // {
  38. // libraryName: 'vant',
  39. // esModule: true,
  40. // resolveStyle: (name) => {
  41. // return `vant/es/${name}/style/index`
  42. // },
  43. // },
  44. // ],
  45. // })
  46. ],
  47. server: {
  48. port: 3000,
  49. cors: true,
  50. proxy: {
  51. '/api-student': {
  52. target: proxyUrl,
  53. changeOrigin: true,
  54. },
  55. '/api-teacher': {
  56. target: proxyUrl,
  57. changeOrigin: true,
  58. },
  59. '/api-backend': {
  60. target: proxyUrl,
  61. changeOrigin: true,
  62. },
  63. '/api-admin': {
  64. target: proxyUrl,
  65. changeOrigin: true,
  66. },
  67. '/api-website': {
  68. target: proxyUrl,
  69. changeOrigin: true,
  70. },
  71. },
  72. },
  73. preview: {
  74. port: 3000
  75. }
  76. })