vite.config.pc.ts 982 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import path from 'node:path';
  2. import { defineConfig, loadConfigFromFile, loadEnv } from "vite";
  3. import Components from "unplugin-vue-components/vite";
  4. const config = defineConfig(({ command, mode, ssrBuild }) => {
  5. return {
  6. plugins: [
  7. Components({
  8. dirs: ["src/pc/components", "src/pc/pages/**/_components"],
  9. resolvers: [
  10. ],
  11. dts: "src/pc/components.d.ts",
  12. }),
  13. ],
  14. server: {
  15. port: 3333,
  16. proxy: {
  17. '/api': {
  18. target: 'https://www.apdmagazine.com/', //测试服务器的
  19. // target: 'http://127.0.0.1:9011/', //测试服务器的
  20. changeOrigin: true,
  21. ws: true,
  22. pathRewrite: {
  23. '^/api': ''
  24. }
  25. }
  26. }
  27. },
  28. }
  29. });
  30. export default config;