vite.config.ts 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import topLevelAwait from 'vite-plugin-top-level-await'
  4. import { resolve } from 'path'
  5. import viteCompression from 'vite-plugin-compression';//Gzip
  6. import { visualizer } from "rollup-plugin-visualizer";
  7. import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' // 【svg-icons相关】
  8. import VitePluginHtmlEnv from 'vite-plugin-html-env'
  9. // https://vitejs.dev/config/
  10. export default defineConfig({
  11. define: {
  12. 'process.env': process.env,
  13. // enable hydration mismatch details in production build
  14. __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false
  15. },
  16. plugins: [vue(), viteCompression(), VitePluginHtmlEnv(), visualizer(), createSvgIconsPlugin({
  17. // 指定需要缓存的图标文件夹
  18. iconDirs: [resolve(process.cwd(), 'src/assets/svg/global'), resolve(process.cwd(), 'src/assets/svg/business')],
  19. // 指定symbolId格式
  20. symbolId: 'icon-[dir]-[name]',
  21. }), topLevelAwait({
  22. promiseExportName: '__tla',
  23. promiseImportName: i => `__tla_${i}`
  24. })],
  25. base: '/',
  26. resolve: {
  27. alias: {
  28. '@': resolve(__dirname, 'src'),
  29. '~@': resolve(__dirname, 'src'),
  30. '@views': resolve(__dirname, 'src/views'),
  31. '@components': resolve(__dirname, 'src/components')
  32. },
  33. },
  34. server: {
  35. port: 1006,
  36. // open: true,
  37. https: false,
  38. base: '/',
  39. host: '0.0.0.0',
  40. strictPort: false,
  41. proxy: {
  42. '/api': {
  43. // target: 'http://localhost:8080/',
  44. target: 'http://120.25.74.229:8000/',
  45. // target: 'http://192.168.1.110:8080/',
  46. changeOrigin: true,
  47. rewrite: path => {
  48. return path.replace(/^\/api/, '')
  49. }
  50. },
  51. '/ax-node-api': {
  52. target: 'http://8.130.72.63:18061/',
  53. changeOrigin: true,
  54. rewrite: path => {
  55. return path.replace(/^\/ax-node-api/, '')
  56. }
  57. },
  58. '/EzServer6-api': {
  59. target: 'http://74.10.28.116:8090/',
  60. changeOrigin: true,
  61. rewrite: path => {
  62. return path
  63. }
  64. },
  65. '/font-api/': {
  66. target: 'http://localhost:1111/',
  67. changeOrigin: true,
  68. rewrite: path => {
  69. return path.replace(/^\/font-api/, '')
  70. }
  71. },
  72. '/ship-playback-ws-api': {
  73. target: 'http://localhost:18062/',
  74. ws: true,
  75. changeOrigin: true,
  76. rewrite: path => {
  77. return path.replace(/^\/ship-playback-ws-api/, '')
  78. }
  79. },
  80. }
  81. },
  82. build: {
  83. outDir: "seat-tools",
  84. },
  85. publicDir: 'src/out',
  86. optimizeDeps: {
  87. include: []
  88. }
  89. })