!19 Vite 由于 optimize.ts 缺少部门文件,导致二次 reload 的问题

Merge pull request !19 from 芋道源码/feat/optimize_vite
This commit is contained in:
芋道源码 2023-03-07 12:08:20 +00:00 committed by Gitee
commit 1c5be6ecbf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 24 additions and 11 deletions

View File

@ -14,6 +14,7 @@ import viteCompression from 'vite-plugin-compression'
import vueSetupExtend from 'vite-plugin-vue-setup-extend' import vueSetupExtend from 'vite-plugin-vue-setup-extend'
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite' import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
export function createVitePlugins(VITE_APP_TITLE: string) { export function createVitePlugins(VITE_APP_TITLE: string) {
const root = process.cwd() const root = process.cwd()
// 路径查找 // 路径查找

View File

@ -67,7 +67,19 @@ const include = [
'element-plus/es/components/dropdown/style/index', 'element-plus/es/components/dropdown/style/index',
'element-plus/es/components/dropdown-menu/style/index', 'element-plus/es/components/dropdown-menu/style/index',
'element-plus/es/components/dropdown-item/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'] const exclude = ['@iconify/json']

View File

@ -59,7 +59,7 @@ import { allSchemas } from './process.create'
import * as DefinitionApi from '@/api/bpm/definition' import * as DefinitionApi from '@/api/bpm/definition'
import * as ProcessInstanceApi from '@/api/bpm/processInstance' import * as ProcessInstanceApi from '@/api/bpm/processInstance'
import { setConfAndFields2 } from '@/utils/formCreate' 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' import { DICT_TYPE } from '@/utils/dict'
const router = useRouter() // const router = useRouter() //

View File

@ -31,15 +31,15 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
port: env.VITE_PORT, port: env.VITE_PORT,
host: "0.0.0.0", host: "0.0.0.0",
open: env.VITE_OPEN === 'true', open: env.VITE_OPEN === 'true',
// 本地跨域代理 // 本地跨域代理. 目前注释的原因暂时没有用途server 端已经支持跨域
proxy: { // proxy: {
['/admin-api']: { // ['/admin-api']: {
target: env.VITE_BASE_URL, // target: env.VITE_BASE_URL,
ws: false, // ws: false,
changeOrigin: true, // changeOrigin: true,
rewrite: (path) => path.replace(new RegExp(`^/admin-api`), ''), // rewrite: (path) => path.replace(new RegExp(`^/admin-api`), ''),
}, // },
}, // },
}, },
// 项目使用的vite插件。 单独提取到build/vite/plugin中管理 // 项目使用的vite插件。 单独提取到build/vite/plugin中管理
plugins: createVitePlugins(env.VITE_APP_TITLE), plugins: createVitePlugins(env.VITE_APP_TITLE),