vite.config.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * @Description:
  3. * @version:
  4. * @Author: 北京四维空间数码科技有限公司-研发部
  5. * @Date: 2022-12-02 17:26:06
  6. * @LastEditors: 北京四维空间数码科技有限公司-研发部
  7. * @LastEditTime: 2023-05-10 11:47:26
  8. */
  9. import { defineConfig } from 'vite'
  10. import vue from '@vitejs/plugin-vue'
  11. import path from 'path';
  12. const HOST = "0.0.0.0"
  13. const REPLACEMENT = `${path.resolve(__dirname, './src')}/`
  14. export default defineConfig({
  15. base: "/",
  16. // server: {
  17. // host: HOST,
  18. // port: process.env.PORT,
  19. // },
  20. server: {
  21. host: HOST,
  22. open: true,
  23. port: process.env.PORT,
  24. proxy: {
  25. "/api": {
  26. // target: "http://192.168.100.252:8080",
  27. // target: "http://192.168.60.42:5004",
  28. target: "http://192.168.60.42:8080",
  29. changeOrigin: true,
  30. rewrite: (path) => path.replace(/^\/api/, ""),
  31. },
  32. "/dzzapi": {
  33. // target: "http://192.168.100.252:8080",
  34. // target: "http://192.168.60.42:9206",
  35. target: "http://192.168.60.42:8080",
  36. changeOrigin: true,
  37. rewrite: (path) => path.replace(/^\/dzzapi/, ""),
  38. },
  39. },
  40. },
  41. resolve: {
  42. alias: [{
  43. find: '@/',
  44. replacement: REPLACEMENT,
  45. },
  46. {
  47. find: 'src/',
  48. replacement: REPLACEMENT,
  49. }, {
  50. find: '~@',
  51. replacement: REPLACEMENT,
  52. },
  53. ],
  54. },
  55. plugins: [
  56. vue(),
  57. ],
  58. build: {
  59. minify: 'terser',
  60. terserOptions: {
  61. compress: {
  62. drop_console: true,
  63. drop_debugger: true,
  64. },
  65. },
  66. },
  67. })