perf(admin): 降低首屏体积并修复 Windows 访问白屏

1) Editor 改 defineAsyncComponent,IEditorConfig 改 import type
2) dev server 绑定 :: 双栈,避免 Windows 下 localhost 走 ::1 超时
3) dev 脚本去掉 POSIX 环境变量前缀,Windows 可直接 pnpm dev
This commit is contained in:
Zhou Weidong authored and trae-solo-agent committed 2026-10-21 13:35:55 +08:00
1 parent 1737f37d82
commit 45507dee8d
4 files changed
+12 -4

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@
"private": true, "private": true,
"scripts": { "scripts": {
"i": "pnpm install", "i": "pnpm install",
"dev": "VITE_CJS_IGNORE_WARNING=1 vite --mode base", "dev": "vite --mode base",
"ts:check": "pnpm vue-tsc --noEmit --skipLibCheck", "ts:check": "pnpm vue-tsc --noEmit --skipLibCheck",
"build:pro": "VITE_CJS_IGNORE_WARNING=1 vite build --mode pro", "build:pro": "VITE_CJS_IGNORE_WARNING=1 vite build --mode pro",
"build:dev": "VITE_CJS_IGNORE_WARNING=1 vite build --mode dev", "build:dev": "VITE_CJS_IGNORE_WARNING=1 vite build --mode dev",
@@ -1,5 +1,6 @@
// Author: fruit.com.cn // Author: fruit.com.cn
import { defineAsyncComponent } from 'vue'
import type { Component } from 'vue' import type { Component } from 'vue'
import { import {
ElCascader, ElCascader,
@@ -23,9 +24,12 @@ import {
ElUpload ElUpload
} from 'element-plus' } from 'element-plus'
import { InputPassword } from '@/components/InputPassword' import { InputPassword } from '@/components/InputPassword'
import { Editor } from '@/components/Editor'
import { ComponentName } from '../types' import { ComponentName } from '../types'
// wang-editor 打包后约 1.1MB:改成异步组件,只有真正渲染编辑器字段时才加载,
// 避免登录页这类只是用了 Form 的页面把它一并拉进首屏。
const Editor = defineAsyncComponent(() => import('@/components/Editor'))
const componentMap: Recordable<Component, ComponentName> = { const componentMap: Recordable<Component, ComponentName> = {
RadioGroup: ElRadioGroup, RadioGroup: ElRadioGroup,
RadioButton: ElRadioGroup, RadioButton: ElRadioGroup,
+2 -1
View File
@@ -22,7 +22,8 @@ import {
ISelectProps, ISelectProps,
UploadProps UploadProps
} from 'element-plus' } from 'element-plus'
import { IEditorConfig } from '@wangeditor/editor' // 仅类型引用:必须用 import type,否则会把整个 wang-editor 打进登录页的依赖链
import type { IEditorConfig } from '@wangeditor/editor'
import { CSSProperties } from 'vue' import { CSSProperties } from 'vue'
export interface PlaceholderModel { export interface PlaceholderModel {
+4 -1
View File
@@ -139,7 +139,10 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
hmr: { hmr: {
overlay: false overlay: false
}, },
host: '0.0.0.0' // 必须同时监听 IPv6:Windows 上 localhost 先解析成 ::1,
// 只绑 0.0.0.0 会让每次新建连接都等 IPv6 超时(约 2s)再回退到 IPv4,
// 表现为页面白屏很久。'::' 是双栈,IPv4 局域网访问同样可用。
host: '::'
}, },
optimizeDeps: { optimizeDeps: {
include: [ include: [