vite.config.ts 989 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import openccPlugin from './src/plugins/opencc-plugin'
  5. // https://vitejs.dev/config/
  6. export default defineConfig({
  7. base: '',
  8. plugins: [
  9. openccPlugin,
  10. vue()
  11. ],
  12. server: {
  13. host: '0.0.0.0',
  14. port: 5173,
  15. proxy: {
  16. '/api': {
  17. target: 'https://server.pptist.cn',
  18. changeOrigin: true,
  19. rewrite: (path) => path.replace(/^\/api/, ''),
  20. },
  21. '/yjs-auth': {
  22. target: 'https://yjsredis.cocorobo.cn',
  23. changeOrigin: true,
  24. rewrite: (path) => path.replace(/^\/yjs-auth/, ''),
  25. }
  26. }
  27. },
  28. css: {
  29. preprocessorOptions: {
  30. scss: {
  31. additionalData: `
  32. @import '@/assets/styles/variable.scss';
  33. @import '@/assets/styles/mixin.scss';
  34. `
  35. },
  36. },
  37. },
  38. resolve: {
  39. alias: {
  40. '@': fileURLToPath(new URL('./src', import.meta.url))
  41. }
  42. }
  43. })