vite.config.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import Components from 'unplugin-vue-components/vite';
  4. import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
  5. import vue from '@vitejs/plugin-vue'
  6. // https://vitejs.dev/config/
  7. export default defineConfig({
  8. base: '/spreadSheet/',
  9. build: {
  10. outDir: 'dist/spreadSheet'
  11. },
  12. plugins: [
  13. vue(),
  14. Components({
  15. resolvers: [AntDesignVueResolver({ importStyle: 'less' })],
  16. }),
  17. ],
  18. resolve: {
  19. alias: {
  20. '@': fileURLToPath(new URL('./src', import.meta.url))
  21. }
  22. },
  23. css: {
  24. preprocessorOptions: {
  25. less: {
  26. modifyVars: {
  27. hack: 'true; @import "@/assets/theme.less"'
  28. },
  29. javascriptEnabled: true
  30. }
  31. }
  32. },
  33. server: {
  34. host: '0.0.0.0',
  35. proxy: {
  36. '/service': {
  37. target: 'http://192.168.4.163',
  38. changeOrigin: true,
  39. rewrite: path => path.replace(RegExp(`^service`), 'service')
  40. },
  41. }
  42. },
  43. })