vite.config.js 1.3 KB

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