From 000b0059c66849d377fcc6593c6ec2741805189d Mon Sep 17 00:00:00 2001 From: "answer.huang" Date: Sun, 5 Mar 2023 23:00:43 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E6=94=B9=E7=94=A8=20https,?= =?UTF-8?q?=E5=8A=A0=E5=BF=AB=E9=A6=96=E6=AC=A1=E6=89=93=E5=BC=80=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/vite/index.ts | 8 +++++++- package.json | 5 ++++- src/types/auto-imports.d.ts | 6 +++++- vite.config.ts | 18 +++++++++--------- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/build/vite/index.ts b/build/vite/index.ts index 717db992..454be623 100644 --- a/build/vite/index.ts +++ b/build/vite/index.ts @@ -14,6 +14,9 @@ import viteCompression from 'vite-plugin-compression' import vueSetupExtend from 'vite-plugin-vue-setup-extend' import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite' import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' +import mkcert from 'vite-plugin-mkcert' +// import PkgConfig from 'vite-plugin-package-config' +// import OptimizationPersist from 'vite-plugin-optimize-persist' export function createVitePlugins(VITE_APP_TITLE: string) { const root = process.cwd() // 路径查找 @@ -93,6 +96,9 @@ export function createVitePlugins(VITE_APP_TITLE: string) { }), ViteEjsPlugin({ title: VITE_APP_TITLE - }) + }), + mkcert(), + // PkgConfig(), + // OptimizationPersist(), ] } diff --git a/package.json b/package.json index 3f040dd1..3d269ba3 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "private": false, "scripts": { "i": "pnpm install", - "dev": "vite --mode base", + "dev": "DEBUG=vite:plugin:mkcert vite --mode base --force", "ts:check": "vue-tsc --noEmit", "build:pro": "vite build --mode pro", "build:dev": "vite build --mode dev", @@ -55,6 +55,9 @@ "qs": "^6.11.0", "steady-xml": "^0.1.0", "url": "^0.11.0", + "vite-plugin-mkcert": "^1.13.0", + "vite-plugin-optimize-persist": "^0.1.2", + "vite-plugin-package-config": "^0.1.1", "vue": "3.2.47", "vue-i18n": "9.2.2", "vue-router": "^4.1.6", diff --git a/src/types/auto-imports.d.ts b/src/types/auto-imports.d.ts index 68e0f7a4..714d6be2 100644 --- a/src/types/auto-imports.d.ts +++ b/src/types/auto-imports.d.ts @@ -40,7 +40,6 @@ declare global { const ref: typeof import('vue')['ref'] const required: typeof import('@/utils/formRules')['required'] const resolveComponent: typeof import('vue')['resolveComponent'] - const resolveDirective: typeof import('vue')['resolveDirective'] const shallowReactive: typeof import('vue')['shallowReactive'] const shallowReadonly: typeof import('vue')['shallowReadonly'] const shallowRef: typeof import('vue')['shallowRef'] @@ -65,3 +64,8 @@ declare global { const watchPostEffect: typeof import('vue')['watchPostEffect'] const watchSyncEffect: typeof import('vue')['watchSyncEffect'] } +// for type re-export +declare global { + // @ts-ignore + export type { Component,ComponentPublicInstance,ComputedRef,InjectionKey,PropType,Ref,VNode } from 'vue' +} diff --git a/vite.config.ts b/vite.config.ts index e5572436..0ca5b697 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -26,20 +26,20 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { // 服务端渲染 server: { // 是否开启 https - https: false, + https: true, // 端口号 port: env.VITE_PORT, host: "0.0.0.0", open: env.VITE_OPEN === 'true', // 本地跨域代理 - proxy: { - ['/admin-api']: { - target: env.VITE_BASE_URL, - ws: false, - changeOrigin: true, - rewrite: (path) => path.replace(new RegExp(`^/admin-api`), ''), - }, - }, + // proxy: { + // ['/admin-api']: { + // target: env.VITE_BASE_URL, + // ws: false, + // changeOrigin: true, + // rewrite: (path) => path.replace(new RegExp(`^/admin-api`), ''), + // }, + // }, }, // 项目使用的vite插件。 单独提取到build/vite/plugin中管理 plugins: createVitePlugins(env.VITE_APP_TITLE), From 7f336bbe9242d4a001ec9fc058c7649b683b0c62 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 7 Mar 2023 19:21:39 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=8F=96=E6=B6=88=20http?= =?UTF-8?q?s=20=E5=8A=A0=E9=80=9F=E6=96=B9=E6=A1=88=EF=BC=8C=E4=B8=BB?= =?UTF-8?q?=E8=A6=81=E8=80=83=E8=99=91=20server=20=E7=AB=AF=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=20https?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/vite/index.ts | 9 ++------- vite.config.ts | 4 +--- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/build/vite/index.ts b/build/vite/index.ts index 41bbc040..304ce0d5 100644 --- a/build/vite/index.ts +++ b/build/vite/index.ts @@ -14,9 +14,7 @@ import viteCompression from 'vite-plugin-compression' import vueSetupExtend from 'vite-plugin-vue-setup-extend' import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite' import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' -import mkcert from 'vite-plugin-mkcert' -// import PkgConfig from 'vite-plugin-package-config' -// import OptimizationPersist from 'vite-plugin-optimize-persist' + export function createVitePlugins(VITE_APP_TITLE: string) { const root = process.cwd() // 路径查找 @@ -96,9 +94,6 @@ export function createVitePlugins(VITE_APP_TITLE: string) { }), ViteEjsPlugin({ title: VITE_APP_TITLE - }), - mkcert(), - // PkgConfig(), - // OptimizationPersist(), + }) ] } diff --git a/vite.config.ts b/vite.config.ts index 0ca5b697..d1ad957f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -25,13 +25,11 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { root: root, // 服务端渲染 server: { - // 是否开启 https - https: true, // 端口号 port: env.VITE_PORT, host: "0.0.0.0", open: env.VITE_OPEN === 'true', - // 本地跨域代理 + // 本地跨域代理. 目前注释的原因:暂时没有用途,server 端已经支持跨域 // proxy: { // ['/admin-api']: { // target: env.VITE_BASE_URL, From 5df7a8c95186b83c36cdabfe10594f480a923529 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 7 Mar 2023 19:40:04 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20optimize=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=88=97=E8=A1=A8=EF=BC=8C=E9=81=BF=E5=85=8D=20reload?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/vite/optimize.ts | 14 +++++++++++++- src/views/bpm/processInstance/create.vue | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/build/vite/optimize.ts b/build/vite/optimize.ts index a4bff7b9..3d90dbac 100644 --- a/build/vite/optimize.ts +++ b/build/vite/optimize.ts @@ -67,7 +67,19 @@ const include = [ 'element-plus/es/components/dropdown/style/index', 'element-plus/es/components/dropdown-menu/style/index', 'element-plus/es/components/dropdown-item/style/index', - 'element-plus/es/components/skeleton/style/index' + 'element-plus/es/components/skeleton/style/index', + 'element-plus/es/components/skeleton/style/css', + 'element-plus/es/components/backtop/style/css', + 'element-plus/es/components/menu/style/css', + 'element-plus/es/components/sub-menu/style/css', + 'element-plus/es/components/menu-item/style/css', + 'element-plus/es/components/dropdown/style/css', + 'element-plus/es/components/tree/style/css', + 'element-plus/es/components/dropdown-menu/style/css', + 'element-plus/es/components/dropdown-item/style/css', + 'element-plus/es/components/badge/style/css', + 'element-plus/es/components/breadcrumb/style/css', + 'element-plus/es/components/breadcrumb-item/style/css' ] const exclude = ['@iconify/json'] diff --git a/src/views/bpm/processInstance/create.vue b/src/views/bpm/processInstance/create.vue index 084c085c..1b59ec7c 100644 --- a/src/views/bpm/processInstance/create.vue +++ b/src/views/bpm/processInstance/create.vue @@ -59,7 +59,7 @@ import { allSchemas } from './process.create' import * as DefinitionApi from '@/api/bpm/definition' import * as ProcessInstanceApi from '@/api/bpm/processInstance' import { setConfAndFields2 } from '@/utils/formCreate' -import { ApiAttrs } from '@form-create/element-ui/types/config' +import type { ApiAttrs } from '@form-create/element-ui/types/config' import { DICT_TYPE } from '@/utils/dict' const router = useRouter() // 路由 From 281bddcd40e0561301eb04fa44ed7c8b551d34e5 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 7 Mar 2023 19:57:46 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20optimize=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=88=97=E8=A1=A8=EF=BC=8C=E9=81=BF=E5=85=8D=20reload?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vite.config.ts b/vite.config.ts index d1ad957f..6b54e183 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -25,6 +25,8 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { root: root, // 服务端渲染 server: { + // 是否开启 https + https: false, // 端口号 port: env.VITE_PORT, host: "0.0.0.0",