vite.config.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. //楚楚
  13. // define: {
  14. // 'process.env': {
  15. // 'BASE_API':"https://cucu.cnyunl.com:8079",
  16. // 'BASE_WS':"wss://cucu.cnyunl.com:8079/"
  17. // }
  18. // },
  19. // 正式地址
  20. // define: {
  21. // 'process.env': {
  22. // 'BASE_API':"https://www.cnyunl.com",
  23. // 'BASE_WS':"wss://lsa.cnyunl.com/"
  24. // }
  25. // },
  26. // 测试地址
  27. define: {
  28. 'process.env': {
  29. 'BASE_API':"http://61.164.207.46:8200",
  30. 'BASE_WS':"ws://61.164.207.46:8200/"
  31. }
  32. },
  33. server: {
  34. proxy: {
  35. "/api": {
  36. target: "http://61.164.207.46:8200/",
  37. // target: "https://www.cnyunl.com/",
  38. ws: true,
  39. changeOrigin: true,
  40. rewrite: (path) => path.replace(/^\/api/, ""),
  41. },
  42. },
  43. host:'0.0.0.0'
  44. },
  45. build: {
  46. rollupOptions: {
  47. output: {
  48. manualChunks: {
  49. vue: ['vue'],
  50. 'vue-router': ['vue-router']
  51. }
  52. }
  53. }
  54. },
  55. css:{
  56. preprocessorOptions:{
  57. less:{
  58. modifyVars: {},
  59. javascriptEnabled: true
  60. }
  61. }
  62. }
  63. })
  64. // ^3.2.15