mirror of
https://gitee.com/bootx/dax-pay-ui
synced 2026-08-13 15:55:43 +08:00
feat 升级适配vite3.x
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import type { PluginOption } from 'vite'
|
||||
import path from 'path'
|
||||
import { viteThemePlugin, antdDarkThemePlugin, mixLighten, mixDarken, tinycolor } from 'vite-plugin-theme'
|
||||
import { viteThemePlugin, antdDarkThemePlugin, mixLighten, mixDarken, tinycolor } from '@rys-fe/vite-plugin-theme'
|
||||
import { getThemeColors, generateColors } from '../../config/themeConfig'
|
||||
import { generateModifyVars } from '../../generate/generateModifyVars'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer'
|
||||
|
||||
const modules = import.meta.globEager('./**/*.ts')
|
||||
const modules: Recordable = import.meta.glob('./**/*.ts', { eager: true })
|
||||
|
||||
const mockModules: any[] = []
|
||||
Object.keys(modules).forEach((key) => {
|
||||
|
||||
23
package.json
23
package.json
@@ -46,6 +46,7 @@
|
||||
"ant-design-vue": "^3.2.15",
|
||||
"axios": "^0.26.1",
|
||||
"bpmn-js": "^10.3.0",
|
||||
"china-area-data": "^5.0.1",
|
||||
"codemirror": "^5.65.3",
|
||||
"cron-parser": "^4.6.0",
|
||||
"cropperjs": "^1.5.12",
|
||||
@@ -71,8 +72,8 @@
|
||||
"vue-json-pretty": "^2.0.6",
|
||||
"vue-router": "^4.0.16",
|
||||
"vue-types": "^4.1.1",
|
||||
"vxe-table": "^4.3.5",
|
||||
"xe-utils": "^3.5.6",
|
||||
"vxe-table": "^4.3.6",
|
||||
"xe-utils": "^3.5.7",
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -95,8 +96,8 @@
|
||||
"@types/sortablejs": "^1.10.7",
|
||||
"@typescript-eslint/eslint-plugin": "^5.20.0",
|
||||
"@typescript-eslint/parser": "^5.20.0",
|
||||
"@vitejs/plugin-legacy": "^1.8.1",
|
||||
"@vitejs/plugin-vue": "^2.3.1",
|
||||
"@vitejs/plugin-legacy": "^2.0.0",
|
||||
"@vitejs/plugin-vue": "^3.0.1",
|
||||
"@vitejs/plugin-vue-jsx": "^1.3.10",
|
||||
"@vue/compiler-sfc": "^3.2.33",
|
||||
"@vue/test-utils": "^2.0.0-rc.21",
|
||||
@@ -134,25 +135,25 @@
|
||||
"stylelint-order": "^5.0.0",
|
||||
"ts-node": "^10.7.0",
|
||||
"typescript": "^4.6.3",
|
||||
"vite": "^2.9.5",
|
||||
"vite": "^3.2.5",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-html": "^3.2.0",
|
||||
"vite-plugin-imagemin": "^0.6.1",
|
||||
"vite-plugin-mkcert": "^1.6.0",
|
||||
"vite-plugin-mkcert": "^1.10.1",
|
||||
"vite-plugin-mock": "^2.9.6",
|
||||
"vite-plugin-purge-icons": "^0.8.1",
|
||||
"vite-plugin-pwa": "^0.11.13",
|
||||
"vite-plugin-purge-icons": "^0.8.2",
|
||||
"vite-plugin-pwa": "^0.12.3",
|
||||
"vite-plugin-style-import": "^2.0.0",
|
||||
"vite-plugin-svg-icons": "^2.0.1",
|
||||
"vite-plugin-theme": "^0.8.6",
|
||||
"@rys-fe/vite-plugin-theme": "^0.8.6",
|
||||
"vite-plugin-vue-setup-extend": "^0.4.0",
|
||||
"vite-plugin-windicss": "^1.8.4",
|
||||
"vite-plugin-windicss": "^1.8.7",
|
||||
"vue-eslint-parser": "^8.3.0",
|
||||
"vue-tsc": "^0.33.9"
|
||||
},
|
||||
"resolutions": {
|
||||
"bin-wrapper": "npm:bin-wrapper-china",
|
||||
"rollup": "^2.56.3",
|
||||
"rollup": "^2.72.0",
|
||||
"gifsicle": "5.2.0"
|
||||
},
|
||||
"repository": {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { genMessage } from '../helper'
|
||||
import antdLocale from 'ant-design-vue/es/locale/en_US'
|
||||
|
||||
const modules = import.meta.globEager('./en/**/*.ts')
|
||||
const modules: Recordable = import.meta.glob('./en/**/*.ts', { eager: true })
|
||||
export default {
|
||||
message: {
|
||||
...genMessage(modules, 'en'),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { genMessage } from '../helper'
|
||||
import antdLocale from 'ant-design-vue/es/locale/zh_CN'
|
||||
|
||||
const modules = import.meta.globEager('./zh-CN/**/*.ts')
|
||||
const modules: Recordable = import.meta.glob('./zh-CN/**/*.ts', { eager: true })
|
||||
export default {
|
||||
message: {
|
||||
...genMessage(modules, 'zh-CN'),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { darkCssIsReady, loadDarkThemeCss } from 'vite-plugin-theme/es/client'
|
||||
import { darkCssIsReady, loadDarkThemeCss } from '@rys-fe/vite-plugin-theme/es/client'
|
||||
import { addClass, hasClass, removeClass } from '/@/utils/domUtils'
|
||||
|
||||
export async function updateDarkTheme(mode: string | null = 'light') {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getThemeColors, generateColors } from '../../../build/config/themeConfig'
|
||||
|
||||
import { replaceStyleVariables } from 'vite-plugin-theme/es/client'
|
||||
import { mixLighten, mixDarken, tinycolor } from 'vite-plugin-theme/es/colorUtils'
|
||||
import { replaceStyleVariables } from '@rys-fe/vite-plugin-theme/es/client'
|
||||
import { mixLighten, mixDarken, tinycolor } from '@rys-fe/vite-plugin-theme/es/colorUtils'
|
||||
|
||||
export async function changeTheme(color: string) {
|
||||
const colors = generateColors({
|
||||
|
||||
@@ -16,6 +16,13 @@ import { setupI18n } from '/@/locales/setupI18n'
|
||||
import { registerGlobComp } from '/@/components/registerGlobComp'
|
||||
import { useTable } from '/@/components/VxeTable'
|
||||
|
||||
import { isDevMode } from './utils/env'
|
||||
|
||||
// 加快开发模式的加载速度, 去了这句开发模式的暗黑主题会有问题
|
||||
if (isDevMode()) {
|
||||
import('ant-design-vue/es/style')
|
||||
}
|
||||
|
||||
async function bootstrap() {
|
||||
const app = createApp(App)
|
||||
|
||||
|
||||
@@ -42,8 +42,7 @@ export function createPermissionGuard(router: Router) {
|
||||
|
||||
// token 不存在
|
||||
if (!token) {
|
||||
// 您可以在未经许可的情况下访问。您需要将路由元.忽略身份验证设置为 true
|
||||
console.log(to)
|
||||
// 您可以在未经许可的情况下访问。您需要将路由meta中的 忽略身份验证设置为 true
|
||||
if (to.meta.ignoreAuth) {
|
||||
next()
|
||||
return
|
||||
|
||||
@@ -10,7 +10,7 @@ import { router } from '/@/router'
|
||||
import { PermissionModeEnum } from '/@/enums/appEnum'
|
||||
import { pathToRegexp } from 'path-to-regexp'
|
||||
|
||||
const modules = import.meta.globEager('./modules/**/*.ts')
|
||||
const modules: Recordable = import.meta.glob('./modules/**/*.ts', { eager: true })
|
||||
|
||||
const menuModules: MenuModule[] = []
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import { mainOutRoutes } from './mainOut'
|
||||
import { PageEnum } from '/@/enums/pageEnum'
|
||||
import { t } from '/@/hooks/web/useI18n'
|
||||
|
||||
// import.meta.globEager() 直接引入所有的模块 Vite 独有的功能
|
||||
const modules = import.meta.globEager('./modules/**/*.ts')
|
||||
// import.meta.glob() 直接引入所有的模块 Vite 独有的功能
|
||||
const modules: Recordable = import.meta.glob('./modules/**/*.ts', { eager: true })
|
||||
const routeModuleList: AppRouteModule[] = []
|
||||
|
||||
// 加入到路由集合中
|
||||
|
||||
@@ -79,7 +79,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||
// },
|
||||
// },
|
||||
// Turning off brotliSize display can slightly reduce packaging time
|
||||
brotliSize: false,
|
||||
reportCompressedSize: false,
|
||||
chunkSizeWarningLimit: 2000,
|
||||
},
|
||||
define: {
|
||||
|
||||
Reference in New Issue
Block a user