vite.config.pc.ts 898 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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: 'http://127.0.0.1:9011/', //测试服务器的
  19. changeOrigin: true,
  20. ws: true,
  21. pathRewrite: {
  22. '^/api': ''
  23. }
  24. }
  25. }
  26. },
  27. }
  28. });
  29. export default config;