vite.config.ts 885 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { fileURLToPath, URL } from 'node:url';
  2. import { defineConfig, loadEnv } from 'vite';
  3. import vue from '@vitejs/plugin-vue';
  4. export default defineConfig(({ mode }) => {
  5. const env = loadEnv(mode, __dirname);
  6. return {
  7. // 静态路径
  8. base: env.VITE_BASE_URL,
  9. // 打包名称
  10. build: {
  11. outDir: env.VITE_OUT_DIR
  12. },
  13. plugins: [vue()],
  14. server: {
  15. host: '0.0.0.0',
  16. port: 9001,
  17. proxy: {
  18. '/files': {
  19. target: 'http://192.168.1.197', // https://broadcast.waityou24.cn
  20. changeOrigin: true
  21. },
  22. '/st/api': {
  23. target: 'http://192.168.1.197:9901', //https://www.ccwit.net
  24. changeOrigin: true,
  25. ws: false
  26. }
  27. },
  28. fs: { strict: false }
  29. },
  30. resolve: {
  31. alias: {
  32. '@': fileURLToPath(new URL('./src', import.meta.url))
  33. }
  34. }
  35. };
  36. });