import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import topLevelAwait from 'vite-plugin-top-level-await' import { resolve } from 'path' import viteCompression from 'vite-plugin-compression';//Gzip import { visualizer } from "rollup-plugin-visualizer"; import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' // 【svg-icons相关】 import VitePluginHtmlEnv from 'vite-plugin-html-env' // https://vitejs.dev/config/ export default defineConfig({ define: { 'process.env': process.env, // enable hydration mismatch details in production build __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false }, plugins: [vue(), viteCompression(), VitePluginHtmlEnv(), visualizer(), createSvgIconsPlugin({ // 指定需要缓存的图标文件夹 iconDirs: [resolve(process.cwd(), 'src/assets/svg/global'), resolve(process.cwd(), 'src/assets/svg/business')], // 指定symbolId格式 symbolId: 'icon-[dir]-[name]', }), topLevelAwait({ promiseExportName: '__tla', promiseImportName: i => `__tla_${i}` })], base: '/', resolve: { alias: { '@': resolve(__dirname, 'src'), '~@': resolve(__dirname, 'src'), '@views': resolve(__dirname, 'src/views'), '@components': resolve(__dirname, 'src/components') }, }, server: { port: 1006, // open: true, https: false, base: '/', host: '0.0.0.0', strictPort: false, proxy: { '/api': { // target: 'http://localhost:8080/', target: 'http://120.25.74.229:8000/', // target: 'http://192.168.1.110:8080/', changeOrigin: true, rewrite: path => { return path.replace(/^\/api/, '') } }, '/ax-node-api': { target: 'http://8.130.72.63:18061/', changeOrigin: true, rewrite: path => { return path.replace(/^\/ax-node-api/, '') } }, '/EzServer6-api': { target: 'http://74.10.28.116:8090/', changeOrigin: true, rewrite: path => { return path } }, '/font-api/': { target: 'http://localhost:1111/', changeOrigin: true, rewrite: path => { return path.replace(/^\/font-api/, '') } }, '/ship-playback-ws-api': { target: 'http://localhost:18062/', ws: true, changeOrigin: true, rewrite: path => { return path.replace(/^\/ship-playback-ws-api/, '') } }, } }, build: { outDir: "seat-tools", }, publicDir: 'src/out', optimizeDeps: { include: [] } })