electron.vite.config.mjs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { resolve } from 'path'
  2. import UnoCSS from 'unocss/vite'
  3. import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
  4. import vue from '@vitejs/plugin-vue'
  5. export default defineConfig({
  6. main: {
  7. plugins: [externalizeDepsPlugin()]
  8. },
  9. preload: {
  10. plugins: [externalizeDepsPlugin()]
  11. },
  12. renderer: {
  13. resolve: {
  14. alias: {
  15. '~src': resolve('src/renderer/src'),
  16. '~ass': resolve('src/renderer/src/assets'),
  17. '~api': resolve('src/renderer/src/api/modules'),
  18. '~store': resolve('src/renderer/src/store/modules'),
  19. }
  20. },
  21. plugins: [
  22. vue({
  23. template: {
  24. compilerOptions: {
  25. isCustomElement: (tag) => tag === 'webview',
  26. }
  27. }
  28. }),
  29. UnoCSS(),
  30. ],
  31. server: {
  32. proxy: {
  33. '/api': {
  34. ws: true,
  35. changeOrigin: true,
  36. //target: 'http://127.0.0.1:8014',
  37. target: 'http://39.108.216.210:8014',
  38. rewrite: (path) => path.replace(new RegExp('^/api'), '/'),
  39. },
  40. },
  41. },
  42. }
  43. })