61 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
		
		
			
		
	
	
			61 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
|  | // electron.vite.config.ts
 | ||
|  | import { resolve } from "path"; | ||
|  | import { defineConfig, externalizeDepsPlugin } from "electron-vite"; | ||
|  | import vue from "@vitejs/plugin-vue"; | ||
|  | import AutoImport from "unplugin-auto-import/vite"; | ||
|  | import Components from "unplugin-vue-components/vite"; | ||
|  | import { ElementPlusResolver } from "unplugin-vue-components/resolvers"; | ||
|  | import { createSvgIconsPlugin } from "vite-plugin-svg-icons"; | ||
|  | import path from "path"; | ||
|  | var electron_vite_config_default = defineConfig({ | ||
|  |   main: { | ||
|  |     plugins: [externalizeDepsPlugin()] | ||
|  |   }, | ||
|  |   preload: { | ||
|  |     plugins: [externalizeDepsPlugin()] | ||
|  |   }, | ||
|  |   renderer: { | ||
|  |     resolve: { | ||
|  |       alias: { | ||
|  |         "@renderer": resolve("src/renderer/src"), | ||
|  |         "@": resolve("src/renderer/src") | ||
|  |       } | ||
|  |     }, | ||
|  |     plugins: [ | ||
|  |       vue(), | ||
|  |       AutoImport({ | ||
|  |         imports: ["vue"], | ||
|  |         dts: "src/auto-imports.d.ts", | ||
|  |         // 自动生成类型声明文件
 | ||
|  |         resolvers: [ElementPlusResolver()] | ||
|  |       }), | ||
|  |       Components({ | ||
|  |         resolvers: [ElementPlusResolver()] | ||
|  |       }), | ||
|  |       // SVG图标插件配置
 | ||
|  |       // 配置SVG图标插件
 | ||
|  |       createSvgIconsPlugin({ | ||
|  |         iconDirs: [path.resolve(process.cwd(), "src/renderer/src/icons/svg")], | ||
|  |         symbolId: "icon-[name]", | ||
|  |         // 自动清除 SVG 中的 fill 和 stroke 属性
 | ||
|  |         svgoOptions: { | ||
|  |           plugins: [{ name: "removeAttrs", params: { attrs: ["fill", "stroke", "stroke-width"] } }] | ||
|  |         } | ||
|  |       }) | ||
|  |     ] | ||
|  |     // server: {
 | ||
|  |     //   port: 8808,
 | ||
|  |     //   proxy: {
 | ||
|  |     //     '/api': {
 | ||
|  |     //       target: localStorage.getItem('ip') || 'http://127.0.0.1:8808',
 | ||
|  |     //       changeOrigin: true,
 | ||
|  |     //       rewrite: (path) => path.replace(/^\/api/, '')
 | ||
|  |     //     }
 | ||
|  |     //   }
 | ||
|  |     // }
 | ||
|  |   } | ||
|  | }); | ||
|  | export { | ||
|  |   electron_vite_config_default as default | ||
|  | }; |