vite.config.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { fileURLToPath, URL } from 'node:url';
  2. import { defineConfig, loadEnv } from 'vite';
  3. import vue from '@vitejs/plugin-vue';
  4. const path = require('path');
  5. const common = path.resolve(__dirname, '../common');
  6. export default defineConfig(({ mode }) => {
  7. const env = loadEnv(mode, __dirname);
  8. return {
  9. // 静态路径
  10. base: env.VITE_BASE_URL,
  11. // 打包名称
  12. build: {
  13. outDir: env.VITE_OUT_DIR,
  14. },
  15. plugins: [vue()],
  16. server: {
  17. port: 8005,
  18. proxy: {
  19. '/files': {
  20. target: 'http://basic.waityou24.cn',
  21. },
  22. '/jcyjdtglpt/v1/api': {
  23. target: 'http://192.168.1.113:13010',
  24. changeOrigin: true,
  25. ws: false,
  26. },
  27. '/semail/api': {
  28. target: 'http://basic.waityou24.cn',
  29. changeOrigin: true,
  30. ws: false,
  31. },
  32. '/studioadmin/api': {
  33. target: 'http://192.168.1.113:16002',
  34. changeOrigin: true,
  35. ws: false,
  36. },
  37. },
  38. fs: {
  39. strict: false,
  40. },
  41. },
  42. resolve: {
  43. alias: {
  44. '@': fileURLToPath(new URL('./src', import.meta.url)),
  45. '@common': common,
  46. },
  47. },
  48. css: {
  49. preprocessorOptions: {
  50. scss: {
  51. additionalData: `@import "@/assets/style/mixin.scss";`, // 此处全局的scss文件
  52. },
  53. },
  54. },
  55. };
  56. });