vite.config.ts 875 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { defineConfig } from "vite";
  2. import vue from "@vitejs/plugin-vue";
  3. // https://vitejs.dev/config/
  4. export default defineConfig({
  5. base: "./",
  6. plugins: [vue()],
  7. css: {
  8. preprocessorOptions: {
  9. less: {
  10. math: "always",
  11. javascriptEnabled: true,
  12. },
  13. },
  14. },
  15. resolve: {
  16. alias: {
  17. "@src": "/src",
  18. "@components": "/src/components",
  19. "@utils": "/src/utils",
  20. "@hooks": "/src/hooks",
  21. "@pages": "/src/pages",
  22. "@assets": "/src/assets",
  23. },
  24. },
  25. build: {
  26. outDir: 'docs'
  27. },
  28. server: {
  29. proxy: {
  30. "/api/weather": {
  31. target: "http://t.weather.itboy.net/api/weather/city",
  32. changeOrigin: true,
  33. rewrite: (path) => {
  34. console.log("rewrite", path.replace(/^\/api/, ""));
  35. return path.replace(/^\/api\/weather/, "");
  36. },
  37. },
  38. },
  39. }
  40. });