update 升级 vite8
update 升级 ts6 update eslint 替换为 Oxlint
This commit is contained in:
@@ -1,328 +0,0 @@
|
|||||||
{
|
|
||||||
"globals": {
|
|
||||||
"Component": true,
|
|
||||||
"ComponentPublicInstance": true,
|
|
||||||
"ComputedRef": true,
|
|
||||||
"DirectiveBinding": true,
|
|
||||||
"EffectScope": true,
|
|
||||||
"ElLoading": true,
|
|
||||||
"ElMessage": true,
|
|
||||||
"ElMessageBox": true,
|
|
||||||
"ElNotification": true,
|
|
||||||
"ExtractDefaultPropTypes": true,
|
|
||||||
"ExtractPropTypes": true,
|
|
||||||
"ExtractPublicPropTypes": true,
|
|
||||||
"InjectionKey": true,
|
|
||||||
"MaybeRef": true,
|
|
||||||
"MaybeRefOrGetter": true,
|
|
||||||
"PropType": true,
|
|
||||||
"Ref": true,
|
|
||||||
"ShallowRef": true,
|
|
||||||
"Slot": true,
|
|
||||||
"Slots": true,
|
|
||||||
"VNode": true,
|
|
||||||
"WritableComputedRef": true,
|
|
||||||
"acceptHMRUpdate": true,
|
|
||||||
"asyncComputed": true,
|
|
||||||
"autoResetRef": true,
|
|
||||||
"computed": true,
|
|
||||||
"computedAsync": true,
|
|
||||||
"computedEager": true,
|
|
||||||
"computedInject": true,
|
|
||||||
"computedWithControl": true,
|
|
||||||
"controlledComputed": true,
|
|
||||||
"controlledRef": true,
|
|
||||||
"createApp": true,
|
|
||||||
"createEventHook": true,
|
|
||||||
"createGlobalState": true,
|
|
||||||
"createInjectionState": true,
|
|
||||||
"createPinia": true,
|
|
||||||
"createReactiveFn": true,
|
|
||||||
"createRef": true,
|
|
||||||
"createReusableTemplate": true,
|
|
||||||
"createSharedComposable": true,
|
|
||||||
"createTemplatePromise": true,
|
|
||||||
"createUnrefFn": true,
|
|
||||||
"customRef": true,
|
|
||||||
"debouncedRef": true,
|
|
||||||
"debouncedWatch": true,
|
|
||||||
"defineAsyncComponent": true,
|
|
||||||
"defineComponent": true,
|
|
||||||
"defineStore": true,
|
|
||||||
"eagerComputed": true,
|
|
||||||
"effectScope": true,
|
|
||||||
"extendRef": true,
|
|
||||||
"getActivePinia": true,
|
|
||||||
"getCurrentInstance": true,
|
|
||||||
"getCurrentScope": true,
|
|
||||||
"getCurrentWatcher": true,
|
|
||||||
"h": true,
|
|
||||||
"ignorableWatch": true,
|
|
||||||
"inject": true,
|
|
||||||
"injectLocal": true,
|
|
||||||
"isDefined": true,
|
|
||||||
"isProxy": true,
|
|
||||||
"isReactive": true,
|
|
||||||
"isReadonly": true,
|
|
||||||
"isRef": true,
|
|
||||||
"isShallow": true,
|
|
||||||
"makeDestructurable": true,
|
|
||||||
"mapActions": true,
|
|
||||||
"mapGetters": true,
|
|
||||||
"mapState": true,
|
|
||||||
"mapStores": true,
|
|
||||||
"mapWritableState": true,
|
|
||||||
"markRaw": true,
|
|
||||||
"nextTick": true,
|
|
||||||
"onActivated": true,
|
|
||||||
"onBeforeMount": true,
|
|
||||||
"onBeforeRouteLeave": true,
|
|
||||||
"onBeforeRouteUpdate": true,
|
|
||||||
"onBeforeUnmount": true,
|
|
||||||
"onBeforeUpdate": true,
|
|
||||||
"onClickOutside": true,
|
|
||||||
"onDeactivated": true,
|
|
||||||
"onElementRemoval": true,
|
|
||||||
"onErrorCaptured": true,
|
|
||||||
"onKeyStroke": true,
|
|
||||||
"onLongPress": true,
|
|
||||||
"onMounted": true,
|
|
||||||
"onRenderTracked": true,
|
|
||||||
"onRenderTriggered": true,
|
|
||||||
"onScopeDispose": true,
|
|
||||||
"onServerPrefetch": true,
|
|
||||||
"onStartTyping": true,
|
|
||||||
"onUnmounted": true,
|
|
||||||
"onUpdated": true,
|
|
||||||
"onWatcherCleanup": true,
|
|
||||||
"pausableWatch": true,
|
|
||||||
"provide": true,
|
|
||||||
"provideLocal": true,
|
|
||||||
"reactify": true,
|
|
||||||
"reactifyObject": true,
|
|
||||||
"reactive": true,
|
|
||||||
"reactiveComputed": true,
|
|
||||||
"reactiveOmit": true,
|
|
||||||
"reactivePick": true,
|
|
||||||
"readonly": true,
|
|
||||||
"ref": true,
|
|
||||||
"refAutoReset": true,
|
|
||||||
"refDebounced": true,
|
|
||||||
"refDefault": true,
|
|
||||||
"refManualReset": true,
|
|
||||||
"refThrottled": true,
|
|
||||||
"refWithControl": true,
|
|
||||||
"resolveComponent": true,
|
|
||||||
"resolveRef": true,
|
|
||||||
"setActivePinia": true,
|
|
||||||
"setMapStoreSuffix": true,
|
|
||||||
"shallowReactive": true,
|
|
||||||
"shallowReadonly": true,
|
|
||||||
"shallowRef": true,
|
|
||||||
"storeToRefs": true,
|
|
||||||
"syncRef": true,
|
|
||||||
"syncRefs": true,
|
|
||||||
"templateRef": true,
|
|
||||||
"throttledRef": true,
|
|
||||||
"throttledWatch": true,
|
|
||||||
"toRaw": true,
|
|
||||||
"toReactive": true,
|
|
||||||
"toRef": true,
|
|
||||||
"toRefs": true,
|
|
||||||
"toValue": true,
|
|
||||||
"triggerRef": true,
|
|
||||||
"tryOnBeforeMount": true,
|
|
||||||
"tryOnBeforeUnmount": true,
|
|
||||||
"tryOnMounted": true,
|
|
||||||
"tryOnScopeDispose": true,
|
|
||||||
"tryOnUnmounted": true,
|
|
||||||
"unref": true,
|
|
||||||
"unrefElement": true,
|
|
||||||
"until": true,
|
|
||||||
"useActiveElement": true,
|
|
||||||
"useAnimate": true,
|
|
||||||
"useArrayDifference": true,
|
|
||||||
"useArrayEvery": true,
|
|
||||||
"useArrayFilter": true,
|
|
||||||
"useArrayFind": true,
|
|
||||||
"useArrayFindIndex": true,
|
|
||||||
"useArrayFindLast": true,
|
|
||||||
"useArrayIncludes": true,
|
|
||||||
"useArrayJoin": true,
|
|
||||||
"useArrayMap": true,
|
|
||||||
"useArrayReduce": true,
|
|
||||||
"useArraySome": true,
|
|
||||||
"useArrayUnique": true,
|
|
||||||
"useAsyncQueue": true,
|
|
||||||
"useAsyncState": true,
|
|
||||||
"useAttrs": true,
|
|
||||||
"useBase64": true,
|
|
||||||
"useBattery": true,
|
|
||||||
"useBluetooth": true,
|
|
||||||
"useBreakpoints": true,
|
|
||||||
"useBroadcastChannel": true,
|
|
||||||
"useBrowserLocation": true,
|
|
||||||
"useCached": true,
|
|
||||||
"useClipboard": true,
|
|
||||||
"useClipboardItems": true,
|
|
||||||
"useCloned": true,
|
|
||||||
"useColorMode": true,
|
|
||||||
"useConfirmDialog": true,
|
|
||||||
"useCountdown": true,
|
|
||||||
"useCounter": true,
|
|
||||||
"useCssModule": true,
|
|
||||||
"useCssSupports": true,
|
|
||||||
"useCssVar": true,
|
|
||||||
"useCssVars": true,
|
|
||||||
"useCurrentElement": true,
|
|
||||||
"useCycleList": true,
|
|
||||||
"useDark": true,
|
|
||||||
"useDateFormat": true,
|
|
||||||
"useDebounce": true,
|
|
||||||
"useDebounceFn": true,
|
|
||||||
"useDebouncedRefHistory": true,
|
|
||||||
"useDeviceMotion": true,
|
|
||||||
"useDeviceOrientation": true,
|
|
||||||
"useDevicePixelRatio": true,
|
|
||||||
"useDevicesList": true,
|
|
||||||
"useDisplayMedia": true,
|
|
||||||
"useDocumentVisibility": true,
|
|
||||||
"useDraggable": true,
|
|
||||||
"useDropZone": true,
|
|
||||||
"useElementBounding": true,
|
|
||||||
"useElementByPoint": true,
|
|
||||||
"useElementHover": true,
|
|
||||||
"useElementSize": true,
|
|
||||||
"useElementVisibility": true,
|
|
||||||
"useEventBus": true,
|
|
||||||
"useEventListener": true,
|
|
||||||
"useEventSource": true,
|
|
||||||
"useEyeDropper": true,
|
|
||||||
"useFavicon": true,
|
|
||||||
"useFetch": true,
|
|
||||||
"useFileDialog": true,
|
|
||||||
"useFileSystemAccess": true,
|
|
||||||
"useFocus": true,
|
|
||||||
"useFocusWithin": true,
|
|
||||||
"useFps": true,
|
|
||||||
"useFullscreen": true,
|
|
||||||
"useGamepad": true,
|
|
||||||
"useGeolocation": true,
|
|
||||||
"useId": true,
|
|
||||||
"useIdle": true,
|
|
||||||
"useImage": true,
|
|
||||||
"useInfiniteScroll": true,
|
|
||||||
"useIntersectionObserver": true,
|
|
||||||
"useInterval": true,
|
|
||||||
"useIntervalFn": true,
|
|
||||||
"useKeyModifier": true,
|
|
||||||
"useLastChanged": true,
|
|
||||||
"useLink": true,
|
|
||||||
"useLocalStorage": true,
|
|
||||||
"useMagicKeys": true,
|
|
||||||
"useManualRefHistory": true,
|
|
||||||
"useMediaControls": true,
|
|
||||||
"useMediaQuery": true,
|
|
||||||
"useMemoize": true,
|
|
||||||
"useMemory": true,
|
|
||||||
"useModel": true,
|
|
||||||
"useMounted": true,
|
|
||||||
"useMouse": true,
|
|
||||||
"useMouseInElement": true,
|
|
||||||
"useMousePressed": true,
|
|
||||||
"useMutationObserver": true,
|
|
||||||
"useNavigatorLanguage": true,
|
|
||||||
"useNetwork": true,
|
|
||||||
"useNow": true,
|
|
||||||
"useObjectUrl": true,
|
|
||||||
"useOffsetPagination": true,
|
|
||||||
"useOnline": true,
|
|
||||||
"usePageLeave": true,
|
|
||||||
"useParallax": true,
|
|
||||||
"useParentElement": true,
|
|
||||||
"usePerformanceObserver": true,
|
|
||||||
"usePermission": true,
|
|
||||||
"usePointer": true,
|
|
||||||
"usePointerLock": true,
|
|
||||||
"usePointerSwipe": true,
|
|
||||||
"usePreferredColorScheme": true,
|
|
||||||
"usePreferredContrast": true,
|
|
||||||
"usePreferredDark": true,
|
|
||||||
"usePreferredLanguages": true,
|
|
||||||
"usePreferredReducedMotion": true,
|
|
||||||
"usePreferredReducedTransparency": true,
|
|
||||||
"usePrevious": true,
|
|
||||||
"useRafFn": true,
|
|
||||||
"useRefHistory": true,
|
|
||||||
"useResizeObserver": true,
|
|
||||||
"useRoute": true,
|
|
||||||
"useRouter": true,
|
|
||||||
"useSSRWidth": true,
|
|
||||||
"useScreenOrientation": true,
|
|
||||||
"useScreenSafeArea": true,
|
|
||||||
"useScriptTag": true,
|
|
||||||
"useScroll": true,
|
|
||||||
"useScrollLock": true,
|
|
||||||
"useSessionStorage": true,
|
|
||||||
"useShare": true,
|
|
||||||
"useSlots": true,
|
|
||||||
"useSorted": true,
|
|
||||||
"useSpeechRecognition": true,
|
|
||||||
"useSpeechSynthesis": true,
|
|
||||||
"useStepper": true,
|
|
||||||
"useStorage": true,
|
|
||||||
"useStorageAsync": true,
|
|
||||||
"useStyleTag": true,
|
|
||||||
"useSupported": true,
|
|
||||||
"useSwipe": true,
|
|
||||||
"useTemplateRef": true,
|
|
||||||
"useTemplateRefsList": true,
|
|
||||||
"useTextDirection": true,
|
|
||||||
"useTextSelection": true,
|
|
||||||
"useTextareaAutosize": true,
|
|
||||||
"useThrottle": true,
|
|
||||||
"useThrottleFn": true,
|
|
||||||
"useThrottledRefHistory": true,
|
|
||||||
"useTimeAgo": true,
|
|
||||||
"useTimeAgoIntl": true,
|
|
||||||
"useTimeout": true,
|
|
||||||
"useTimeoutFn": true,
|
|
||||||
"useTimeoutPoll": true,
|
|
||||||
"useTimestamp": true,
|
|
||||||
"useTitle": true,
|
|
||||||
"useToNumber": true,
|
|
||||||
"useToString": true,
|
|
||||||
"useToggle": true,
|
|
||||||
"useTransition": true,
|
|
||||||
"useUrlSearchParams": true,
|
|
||||||
"useUserMedia": true,
|
|
||||||
"useVModel": true,
|
|
||||||
"useVModels": true,
|
|
||||||
"useVibrate": true,
|
|
||||||
"useVirtualList": true,
|
|
||||||
"useWakeLock": true,
|
|
||||||
"useWebNotification": true,
|
|
||||||
"useWebSocket": true,
|
|
||||||
"useWebWorker": true,
|
|
||||||
"useWebWorkerFn": true,
|
|
||||||
"useWindowFocus": true,
|
|
||||||
"useWindowScroll": true,
|
|
||||||
"useWindowSize": true,
|
|
||||||
"watch": true,
|
|
||||||
"watchArray": true,
|
|
||||||
"watchAtMost": true,
|
|
||||||
"watchDebounced": true,
|
|
||||||
"watchDeep": true,
|
|
||||||
"watchEffect": true,
|
|
||||||
"watchIgnorable": true,
|
|
||||||
"watchImmediate": true,
|
|
||||||
"watchOnce": true,
|
|
||||||
"watchPausable": true,
|
|
||||||
"watchPostEffect": true,
|
|
||||||
"watchSyncEffect": true,
|
|
||||||
"watchThrottled": true,
|
|
||||||
"watchTriggerable": true,
|
|
||||||
"watchWithFilter": true,
|
|
||||||
"whenever": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
|
||||||
|
"plugins": ["vue", "typescript"],
|
||||||
|
"rules": {
|
||||||
|
"typescript/no-empty-function": "off",
|
||||||
|
"typescript/no-explicit-any": "off",
|
||||||
|
"typescript/no-unused-vars": "off",
|
||||||
|
"typescript/no-this-alias": "off",
|
||||||
|
"typescript/no-empty-object-type": "off",
|
||||||
|
"typescript/no-unused-expressions": "off",
|
||||||
|
"vue/multi-word-component-names": "off",
|
||||||
|
"prefer-rest-params": "off"
|
||||||
|
},
|
||||||
|
"ignore": ["dist/**", "dist-ssr/**", "coverage/**"]
|
||||||
|
}
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
import pluginVue from 'eslint-plugin-vue';
|
|
||||||
import globals from 'globals';
|
|
||||||
import prettier from 'eslint-plugin-prettier';
|
|
||||||
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript';
|
|
||||||
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';
|
|
||||||
|
|
||||||
export default defineConfigWithVueTs(
|
|
||||||
{
|
|
||||||
name: 'app/files-to-lint',
|
|
||||||
files: ['**/*.{js,cjs,ts,mts,tsx,vue}']
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
name: 'app/files-to-ignore',
|
|
||||||
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
languageOptions: {
|
|
||||||
globals: globals.browser
|
|
||||||
}
|
|
||||||
},
|
|
||||||
pluginVue.configs['flat/essential'],
|
|
||||||
vueTsConfigs.recommended,
|
|
||||||
skipFormatting,
|
|
||||||
{
|
|
||||||
plugins: { prettier },
|
|
||||||
rules: {
|
|
||||||
'@typescript-eslint/no-empty-function': 'off',
|
|
||||||
'@typescript-eslint/no-explicit-any': 'off',
|
|
||||||
'@typescript-eslint/no-unused-vars': 'off',
|
|
||||||
'@typescript-eslint/no-this-alias': 'off',
|
|
||||||
// vue
|
|
||||||
'vue/multi-word-component-names': 'off',
|
|
||||||
'vue/valid-define-props': 'off',
|
|
||||||
'vue/no-v-model-argument': 'off',
|
|
||||||
'prefer-rest-params': 'off',
|
|
||||||
// prettier
|
|
||||||
'prettier/prettier': 'error',
|
|
||||||
// 允许使用空Object类型 {}
|
|
||||||
'@typescript-eslint/no-empty-object-type': 'off',
|
|
||||||
'@typescript-eslint/no-unused-expressions': 'off'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
+6
-12
@@ -11,8 +11,8 @@
|
|||||||
"build:prod": "vite build --mode production",
|
"build:prod": "vite build --mode production",
|
||||||
"build:dev": "vite build --mode development",
|
"build:dev": "vite build --mode development",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"lint:eslint": "eslint",
|
"lint": "oxlint src",
|
||||||
"lint:eslint:fix": "eslint --fix",
|
"lint:fix": "oxlint --fix src",
|
||||||
"prettier": "prettier --write ."
|
"prettier": "prettier --write ."
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -51,25 +51,19 @@
|
|||||||
"@types/nprogress": "0.2.3",
|
"@types/nprogress": "0.2.3",
|
||||||
"@unocss/preset-attributify": "66.6.6",
|
"@unocss/preset-attributify": "66.6.6",
|
||||||
"@unocss/preset-wind3": "66.6.6",
|
"@unocss/preset-wind3": "66.6.6",
|
||||||
"@vitejs/plugin-vue": "6.0.4",
|
"@vitejs/plugin-vue": "^6.0.5",
|
||||||
"@vue/compiler-sfc": "3.5.30",
|
"@vue/compiler-sfc": "3.5.30",
|
||||||
"@vue/eslint-config-prettier": "10.2.0",
|
|
||||||
"@vue/eslint-config-typescript": "14.6.0",
|
|
||||||
"autoprefixer": "10.4.27",
|
"autoprefixer": "10.4.27",
|
||||||
"eslint": "9.39.1",
|
"oxlint": "^1.58.0",
|
||||||
"eslint-plugin-prettier": "5.5.5",
|
|
||||||
"eslint-plugin-vue": "9.33.0",
|
|
||||||
"globals": "17.4.0",
|
|
||||||
"prettier": "3.8.1",
|
"prettier": "3.8.1",
|
||||||
"sass": "1.98.0",
|
"sass": "1.98.0",
|
||||||
"typescript": "~5.9.3",
|
"typescript": "^6.0.2",
|
||||||
"unocss": "66.6.6",
|
"unocss": "66.6.6",
|
||||||
"unplugin-auto-import": "21.0.0",
|
"unplugin-auto-import": "21.0.0",
|
||||||
"unplugin-vue-components": "31.0.0",
|
"unplugin-vue-components": "31.0.0",
|
||||||
"unplugin-vue-setup-extend-plus": "1.0.1",
|
"unplugin-vue-setup-extend-plus": "1.0.1",
|
||||||
"vite": "7.3.1",
|
"vite": "^8.0.3",
|
||||||
"vite-plugin-svg-icons-ng": "^1.5.2",
|
"vite-plugin-svg-icons-ng": "^1.5.2",
|
||||||
"vite-plugin-vue-devtools": "8.0.7",
|
|
||||||
"vitest": "4.0.18",
|
"vitest": "4.0.18",
|
||||||
"vue-tsc": "^3.2.5"
|
"vue-tsc": "^3.2.5"
|
||||||
},
|
},
|
||||||
|
|||||||
+9
-9
@@ -19,16 +19,16 @@ const isWhiteList = (path: string) => {
|
|||||||
return whiteList.some((pattern) => isPathMatch(pattern, path));
|
return whiteList.some((pattern) => isPathMatch(pattern, path));
|
||||||
};
|
};
|
||||||
|
|
||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from) => {
|
||||||
NProgress.start();
|
NProgress.start();
|
||||||
if (getToken()) {
|
if (getToken()) {
|
||||||
to.meta.title && useSettingsStore().setTitle(to.meta.title as string);
|
to.meta.title && useSettingsStore().setTitle(to.meta.title as string);
|
||||||
/* has token*/
|
/* has token*/
|
||||||
if (to.path === '/login') {
|
if (to.path === '/login') {
|
||||||
next({ path: '/' });
|
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
|
return { path: '/' };
|
||||||
} else if (isWhiteList(to.path)) {
|
} else if (isWhiteList(to.path)) {
|
||||||
next();
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (useUserStore().roles.length === 0) {
|
if (useUserStore().roles.length === 0) {
|
||||||
isRelogin.show = true;
|
isRelogin.show = true;
|
||||||
@@ -37,7 +37,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
if (err) {
|
if (err) {
|
||||||
await useUserStore().logout();
|
await useUserStore().logout();
|
||||||
ElMessage.error(err);
|
ElMessage.error(err);
|
||||||
next({ path: '/' });
|
return { path: '/' };
|
||||||
} else {
|
} else {
|
||||||
isRelogin.show = false;
|
isRelogin.show = false;
|
||||||
const accessRoutes = await usePermissionStore().generateRoutes();
|
const accessRoutes = await usePermissionStore().generateRoutes();
|
||||||
@@ -47,22 +47,22 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
router.addRoute(route); // 动态添加可访问路由表
|
router.addRoute(route); // 动态添加可访问路由表
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// @ts-expect-error hack方法 确保addRoutes已完成
|
// hack方法 确保addRoutes已完成
|
||||||
next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack方法 确保addRoutes已完成
|
return { path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string };
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
next();
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 没有token
|
// 没有token
|
||||||
if (isWhiteList(to.path)) {
|
if (isWhiteList(to.path)) {
|
||||||
// 在免登录白名单,直接进入
|
// 在免登录白名单,直接进入
|
||||||
next();
|
return true;
|
||||||
} else {
|
} else {
|
||||||
const redirect = encodeURIComponent(to.fullPath || '/');
|
const redirect = encodeURIComponent(to.fullPath || '/');
|
||||||
next(`/login?redirect=${redirect}`); // 否则全部重定向到登录页
|
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
|
return `/login?redirect=${redirect}`; // 否则全部重定向到登录页
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-5
@@ -1,12 +1,9 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
|
||||||
// https://vite.dev/config/build-options.html#build-target
|
|
||||||
"target": "ES2020",
|
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "Bundler",
|
"moduleResolution": "Bundler",
|
||||||
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
"lib": ["ESNext", "DOM"],
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
// This setting lets you specify a file for storing incremental compilation information as a part of composite projects which enables faster building of larger TypeScript codebases.
|
// This setting lets you specify a file for storing incremental compilation information as a part of composite projects which enables faster building of larger TypeScript codebases.
|
||||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildinfo",
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildinfo",
|
||||||
@@ -35,7 +32,6 @@
|
|||||||
"src/**/*.vue",
|
"src/**/*.vue",
|
||||||
"vite.config.ts",
|
"vite.config.ts",
|
||||||
"vitest.config.ts",
|
"vitest.config.ts",
|
||||||
"eslint.config.ts",
|
|
||||||
"src/**/*.d.ts"
|
"src/**/*.d.ts"
|
||||||
],
|
],
|
||||||
"exclude": ["node_modules", "dist", "src/**/__tests__/*"]
|
"exclude": ["node_modules", "dist", "src/**/__tests__/*"]
|
||||||
|
|||||||
+1
-21
@@ -1,7 +1,6 @@
|
|||||||
import { defineConfig, loadEnv } from 'vite';
|
import { defineConfig, loadEnv } from 'vite';
|
||||||
import createPlugins from './vite/plugins';
|
import createPlugins from './vite/plugins';
|
||||||
import autoprefixer from 'autoprefixer'; // css自动添加兼容性前缀
|
import autoprefixer from 'autoprefixer'; // css自动添加兼容性前缀
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
export default defineConfig(({ mode, command }) => {
|
export default defineConfig(({ mode, command }) => {
|
||||||
const env = loadEnv(mode, process.cwd());
|
const env = loadEnv(mode, process.cwd());
|
||||||
@@ -11,9 +10,7 @@ export default defineConfig(({ mode, command }) => {
|
|||||||
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
|
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
|
||||||
base: env.VITE_APP_CONTEXT_PATH,
|
base: env.VITE_APP_CONTEXT_PATH,
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
tsconfigPaths: true,
|
||||||
'@': path.resolve(__dirname, './src')
|
|
||||||
},
|
|
||||||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
|
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
|
||||||
},
|
},
|
||||||
// https://cn.vitejs.dev/config/#resolve-extensions
|
// https://cn.vitejs.dev/config/#resolve-extensions
|
||||||
@@ -52,23 +49,6 @@ export default defineConfig(({ mode, command }) => {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
// 预编译
|
|
||||||
optimizeDeps: {
|
|
||||||
entries: ['src/**/*.vue'],
|
|
||||||
include: [
|
|
||||||
'vue',
|
|
||||||
'vue-router',
|
|
||||||
'pinia',
|
|
||||||
'axios',
|
|
||||||
'@vueuse/core',
|
|
||||||
'echarts',
|
|
||||||
'vue-i18n',
|
|
||||||
'@wangeditor-next/editor',
|
|
||||||
'@wangeditor-next/editor-for-vue',
|
|
||||||
'image-conversion',
|
|
||||||
'element-plus/es/components/**/style/css'
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
import AutoImport from 'unplugin-auto-import/vite';
|
import AutoImport from 'unplugin-auto-import/vite';
|
||||||
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
|
||||||
|
import { resolve } from 'path';
|
||||||
|
|
||||||
export default (path: any) => {
|
export default () => {
|
||||||
return AutoImport({
|
return AutoImport({
|
||||||
// 自动导入 Vue 相关函数
|
// 自动导入 Vue 相关函数
|
||||||
imports: ['vue', 'vue-router', '@vueuse/core', 'pinia'],
|
imports: ['vue', 'vue-router', '@vueuse/core', 'pinia'],
|
||||||
eslintrc: {
|
|
||||||
enabled: true,
|
|
||||||
filepath: './.eslintrc-auto-import.json',
|
|
||||||
globalsPropValue: true
|
|
||||||
},
|
|
||||||
resolvers: [
|
resolvers: [
|
||||||
// 自动导入 Element Plus 相关函数ElMessage, ElMessageBox... (带样式)
|
// 自动导入 Element Plus 相关函数ElMessage, ElMessageBox... (带样式)
|
||||||
ElementPlusResolver({
|
ElementPlusResolver({
|
||||||
@@ -17,6 +13,6 @@ export default (path: any) => {
|
|||||||
})
|
})
|
||||||
],
|
],
|
||||||
vueTemplate: true, // 是否在 vue 模板中自动导入
|
vueTemplate: true, // 是否在 vue 模板中自动导入
|
||||||
dts: path.resolve(path.resolve(__dirname, '../../src'), 'types', 'auto-imports.d.ts')
|
dts: resolve(import.meta.dirname, '../../src/types/auto-imports.d.ts')
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import Components from 'unplugin-vue-components/vite';
|
import Components from 'unplugin-vue-components/vite';
|
||||||
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
|
||||||
|
import { resolve } from 'path';
|
||||||
|
|
||||||
export default (path: any) => {
|
export default () => {
|
||||||
return Components({
|
return Components({
|
||||||
resolvers: [
|
resolvers: [
|
||||||
// 自动导入 Element Plus 组件
|
// 自动导入 Element Plus 组件
|
||||||
@@ -9,6 +10,6 @@ export default (path: any) => {
|
|||||||
importStyle: false
|
importStyle: false
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
dts: path.resolve(path.resolve(__dirname, '../../src'), 'types', 'components.d.ts')
|
dts: resolve(import.meta.dirname, '../../src/types/components.d.ts')
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import vue from '@vitejs/plugin-vue';
|
import vue from '@vitejs/plugin-vue';
|
||||||
import vueDevTools from 'vite-plugin-vue-devtools';
|
|
||||||
|
|
||||||
import createUnoCss from './unocss';
|
import createUnoCss from './unocss';
|
||||||
import createAutoImport from './auto-import';
|
import createAutoImport from './auto-import';
|
||||||
@@ -7,17 +6,15 @@ import createComponents from './components';
|
|||||||
import createSvgIconsPlugin from './svg-icon';
|
import createSvgIconsPlugin from './svg-icon';
|
||||||
import createCompression from './compression';
|
import createCompression from './compression';
|
||||||
import createSetupExtend from './setup-extend';
|
import createSetupExtend from './setup-extend';
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
export default (viteEnv: any, isBuild = false): [] => {
|
export default (viteEnv: any, isBuild = false): [] => {
|
||||||
const vitePlugins: any = [];
|
const vitePlugins: any = [];
|
||||||
vitePlugins.push(vue());
|
vitePlugins.push(vue());
|
||||||
vitePlugins.push(vueDevTools());
|
|
||||||
vitePlugins.push(createUnoCss());
|
vitePlugins.push(createUnoCss());
|
||||||
vitePlugins.push(createAutoImport(path));
|
vitePlugins.push(createAutoImport());
|
||||||
vitePlugins.push(createComponents(path));
|
vitePlugins.push(createComponents());
|
||||||
vitePlugins.push(createCompression(viteEnv));
|
vitePlugins.push(createCompression(viteEnv));
|
||||||
vitePlugins.push(createSvgIconsPlugin(path));
|
vitePlugins.push(createSvgIconsPlugin());
|
||||||
vitePlugins.push(createSetupExtend());
|
vitePlugins.push(createSetupExtend());
|
||||||
return vitePlugins;
|
return vitePlugins;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons-ng';
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons-ng';
|
||||||
|
import { resolve } from 'path';
|
||||||
|
|
||||||
export default (path: any) => {
|
export default () => {
|
||||||
return createSvgIconsPlugin({
|
return createSvgIconsPlugin({
|
||||||
// 指定需要缓存的图标文件夹
|
// 指定需要缓存的图标文件夹
|
||||||
iconDirs: [path.resolve(path.resolve(__dirname, '../../src'), 'assets/icons/svg')],
|
iconDirs: [resolve(import.meta.dirname, '../../src/assets/icons/svg')],
|
||||||
// 指定symbolId格式
|
// 指定symbolId格式
|
||||||
symbolId: 'icon-[dir]-[name]'
|
symbolId: 'icon-[dir]-[name]'
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user