vite.config.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import { resolve } from 'path'
  4. export default defineConfig({
  5. base: process.env.NODE_ENV === 'production' ? './' : '/',
  6. plugins: [vue()],
  7. resolve: {
  8. alias: {
  9. '@': resolve(__dirname, 'src')
  10. }
  11. },
  12. define: {
  13. 'process.env': {
  14. 'BASE_API':"https://cucu.cnyunl.com:8079/"
  15. }
  16. },
  17. server: {
  18. proxy: {
  19. "/api": {
  20. target: "https://cucu.cnyunl.com:8079/",
  21. ws: true,
  22. changeOrigin: true,
  23. rewrite: (path) => path.replace(/^\/api/, ""),
  24. },
  25. },
  26. },
  27. // define: {
  28. // 'process.env': {
  29. // 'BASE_API':"http://61.164.207.46:8200/"
  30. // }
  31. // },
  32. // server: {
  33. // proxy: {
  34. // "/api": {
  35. // target: "http://61.164.207.46:8200/",
  36. // ws: true,
  37. // changeOrigin: true,
  38. // rewrite: (path) => path.replace(/^\/api/, ""),
  39. // },
  40. // },
  41. // host:'0.0.0.0'
  42. // },
  43. build: {
  44. rollupOptions: {
  45. output: {
  46. manualChunks: {
  47. vue: ['vue'],
  48. 'vue-router': ['vue-router']
  49. }
  50. }
  51. }
  52. },
  53. css:{
  54. preprocessorOptions:{
  55. less:{
  56. modifyVars: {},
  57. javascriptEnabled: true
  58. }
  59. }
  60. }
  61. })