vite.config.ts 854 B

1234567891011121314151617181920212223242526272829303132333435
  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. port: 9009,
  16. host: '0.0.0.0',
  17. proxy: {
  18. '/files': {
  19. target: 'http://192.168.1.197', // https://broadcast.waityou24.cn
  20. changeOrigin: true
  21. },
  22. [env.VITE_APP_BASE_API]: {
  23. changeOrigin: true,
  24. target: 'http://192.168.1.113:9700'
  25. }
  26. },
  27. fs: { strict: false }
  28. },
  29. resolve: {
  30. alias: {
  31. '@': fileURLToPath(new URL('./src', import.meta.url))
  32. }
  33. }
  34. };
  35. });