vite.config.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { defineConfig } from "vite";
  2. import vue from "@vitejs/plugin-vue";
  3. import Components from "unplugin-vue-components/vite";
  4. import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
  5. import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
  6. import { resolve } from "path";
  7. const resolvePath = (...args) => {
  8. return resolve(__dirname, ...args);
  9. };
  10. // const SERVER_URL = "http://192.168.10.108:7180";
  11. // const SERVER_URL = "http://192.168.10.138:13800";
  12. const SERVER_URL = "http://192.168.10.39:7100";
  13. // const SERVER_URL = "http://192.168.10.141:7100";
  14. // const SERVER_URL = "http://192.168.10.106:7100";
  15. // https://vitejs.dev/config/
  16. export default defineConfig({
  17. plugins: [
  18. vue({
  19. reactivityTransform: true,
  20. }),
  21. Components({
  22. resolvers: [
  23. AntDesignVueResolver({
  24. importStyle: false,
  25. }),
  26. ],
  27. }),
  28. createSvgIconsPlugin({
  29. iconDirs: [resolvePath("src/assets/svgs")],
  30. symbolId: "icon-[name]",
  31. customDomId: "__svg__icons__dom__",
  32. svgoOptions: {
  33. full: true,
  34. plugins: [
  35. {
  36. name: "removeAttrs",
  37. params: {
  38. attrs: ["class", "data-name", "fill", "stroke"],
  39. },
  40. },
  41. ],
  42. },
  43. }),
  44. ],
  45. server: {
  46. port: 9000,
  47. // strictPort: true,
  48. fs: {
  49. strict: true,
  50. allow: ["./"],
  51. },
  52. proxy: {
  53. "/api": {
  54. target: SERVER_URL,
  55. changeOrigin: true,
  56. },
  57. },
  58. },
  59. resolve: {
  60. alias: [{ find: "@", replacement: resolve(__dirname, "./src") }],
  61. extensions: [".js", ".mjs", ".ts", ".vue", ".json", ".scss", ".css"],
  62. },
  63. build: {
  64. ssr: false,
  65. },
  66. // define: {
  67. // __VUE_PROD_DEVTOOLS__: true, // no effect
  68. // },
  69. });