vite.config.js 1.2 KB

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