Skip to content

Commit 0d2cb00

Browse files
committed
fix: resolve Vue 3 TypeScript compilation errors
- Fix ReferenceError 'isVueApp before initialization' in useParseRouter.ts - Add Vue module declarations to env.d.ts for proper TypeScript support - Update package-lock.json with dependency changes
1 parent ab2d741 commit 0d2cb00

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scaffold-vue/env.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
/// <reference types="vite/client" />
2+
3+
declare module '*.vue' {
4+
import type { DefineComponent } from 'vue'
5+
const component: DefineComponent<{}, {}, any>
6+
export default component
7+
}

src/hooks/useParseRouter.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ export function useParseRouter(appId: number | null) {
4848
error: vueAppError,
4949
} = useLoadAppFile(appId, "src/App.vue");
5050

51-
// Use frontend router content if available, otherwise fallback to root or Vue specific
52-
const finalRouterContent = isVueApp ? vueAppContent : (frontendRouterContent || routerContent);
53-
const finalRouterLoading = frontendRouterFileLoading || routerFileLoading || (isVueApp ? vueAppLoading : false);
54-
const finalRouterError = frontendRouterFileError || routerFileError || (isVueApp ? vueAppError : false);
55-
5651
// Detect Next.js app by presence of next.config.* in file list
5752
const isNextApp = useMemo(() => {
5853
if (!app?.files) return false;
@@ -65,6 +60,11 @@ export function useParseRouter(appId: number | null) {
6560
return app.files.some((f) => f.toLowerCase().endsWith(".vue"));
6661
}, [app?.files]);
6762

63+
// Use frontend router content if available, otherwise fallback to root or Vue specific
64+
const finalRouterContent = isVueApp ? vueAppContent : (frontendRouterContent || routerContent);
65+
const finalRouterLoading = frontendRouterFileLoading || routerFileLoading || (isVueApp ? vueAppLoading : false);
66+
const finalRouterError = frontendRouterFileError || routerFileError || (isVueApp ? vueAppError : false);
67+
6868
// Parse routes either from Next.js file-based routing or from router file
6969
useEffect(() => {
7070
const buildLabel = (path: string) =>

0 commit comments

Comments
 (0)