From 99578a45486e5f29eef51054ac62b875a7da0817 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Fri, 22 Sep 2023 00:27:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20:bug:=20=E4=BF=AE=E6=94=B9=20`mock`=20?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=97=A0=E6=95=88=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- vite.config.ts | 16 +++++----------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 0c9a9d7..755b313 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vue3-element-admin", "private": true, - "version": "2.6.1", + "version": "2.6.2", "scripts": { "preinstall": "npx only-allow pnpm", "dev": "vite serve --mode development", @@ -106,7 +106,7 @@ "unplugin-icons": "^0.16.1", "unplugin-vue-components": "^0.24.1", "vite": "^4.4.9", - "vite-plugin-mock": "^3.0.0", + "vite-plugin-mock": "^2.9.6", "vite-plugin-svg-icons": "^2.0.1", "vue-tsc": "^1.7.0 " }, diff --git a/vite.config.ts b/vite.config.ts index 0f0d0ed..553e3ba 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -52,7 +52,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { path.replace( new RegExp("^" + env.VITE_APP_BASE_API), // ^/dev-api env.VITE_APP_TARGET_BASE_API // "" - ), // 以 /dev-api 开头的请求转发至 target,示例: http://localhost:3000/dev-api/v1/users (F12可见) 代理转发 https://api.xxx.com/v1/users (真实接口地址) + ), // 将 /dev-api 开头的请求转发至 target }, }, }, @@ -62,7 +62,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { hmrTopLevelAwait: false, }), AutoImport({ - imports: ["vue", "@vueuse/core"], // 自动导入 Vue 相关函数,如:ref, reactive, toRef 等 + imports: ["vue", "@vueuse/core"], eslintrc: { enabled: false, filepath: "./.eslintrc-auto-import.json", @@ -80,7 +80,6 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { Components({ resolvers: [ ElementPlusResolver(), // 自动导入 Element Plus 组件 - // 自动导入 Icon 组件 IconsResolver({ enabledCollections: ["ep"], // @iconify-json/ep 是 Element Plus 的图标库 }), @@ -91,24 +90,19 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { }), Icons({ - // 自动安装图标库 autoInstall: true, }), createSvgIconsPlugin({ - // 指定需要缓存的图标文件夹 - iconDirs: [path.resolve(pathSrc, "assets/icons")], - // 指定symbolId格式 - symbolId: "icon-[dir]-[name]", + iconDirs: [path.resolve(pathSrc, "assets/icons")], // 指定需要缓存的图标文件夹 + symbolId: "icon-[dir]-[name]", // 指定symbolId格式 }), - // https://github.com/anncwb/vite-plugin-mock/issues/9 viteMockServe({ ignore: /^\_/, mockPath: "mock", enable: mode === "development", - watchFiles: false, }), ], - // 预加载项目必需的组件 + /** 预加载项目必需的组件 */ optimizeDeps: { include: [ "vue",