12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { defineConfig } from "vite";
  2. import path from "path";
  3. import react from "@vitejs/plugin-react";
  4. import vitePluginImp from "vite-plugin-imp";
  5. // https://vitejs.dev/config/
  6. export default defineConfig({
  7. server: {
  8. port: 3001,
  9. host: "0.0.0.0",
  10. proxy: {
  11. '/api': {
  12. target: 'http://192.168.89.25:9111',
  13. changeOrigin: true,
  14. },
  15. },
  16. },
  17. plugins: [
  18. react(),
  19. vitePluginImp({
  20. libList: [
  21. {
  22. libName: "antd",
  23. style: (name) => `antd/es/${name}/style`,
  24. },
  25. ],
  26. })
  27. ],
  28. resolve: {
  29. alias: [{ find: "@", replacement: path.resolve(__dirname, "src") }],
  30. },
  31. css: {
  32. preprocessorOptions: {
  33. less: {
  34. // modifyVars: { 'primary-color': '#13c2c2' },
  35. javascriptEnabled: true,
  36. },
  37. },
  38. },
  39. build: {
  40. outDir: 'dist', // 打包输出目录
  41. assetsDir: 'assets', // 静态资源目录 (相对于 outputDir)
  42. minify: true, // 是否进行代码压缩
  43. }
  44. });