vite.config.js 1.1 KB

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