vite.config.js 1022 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import path from 'path'
  4. import Components from 'unplugin-vue-components/vite'
  5. import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'
  6. export default defineConfig({
  7. plugins: [
  8. vue(),
  9. Components({
  10. resolvers: [
  11. AntDesignVueResolver({
  12. importStyle: false, // css in js
  13. })
  14. ],
  15. })
  16. ],
  17. resolve: {
  18. alias: {
  19. '@': path.resolve(__dirname, 'src')
  20. }
  21. },
  22. css: {
  23. preprocessorOptions: {
  24. less: {
  25. math: 'always',
  26. globalVars: {},
  27. modifyVars: {
  28. 'hack': 'true; @import "@/styles/variables.less";'
  29. }
  30. }
  31. }
  32. },
  33. server: {
  34. port: 3000,
  35. open: true,
  36. proxy: {
  37. // '/api': {
  38. // // target: 'https://jiasm.zfire.top/zfdapi/',
  39. // target: 'https://jiasm.zfire.top',
  40. // ws: true,
  41. // changeOrigin: true,
  42. // rewrite: (path) => path.replace(/^\/api/, '')
  43. // }
  44. }
  45. }
  46. })