Skip to content

Vue imports using tsconfig path aliases do not create Relationships #354

Description

@Cpu1998

Description

Vue SFC imports that use a TypeScript path alias are not resolved to workspace files, so CodeGraphy does not create a Relationship between the corresponding File Nodes.

Relative imports work correctly.

Reproduction

Given this tsconfig.json:

{
  "compilerOptions": {
    "moduleResolution": "bundler",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}

And the following files:

src/
├── components/MeasureTool.vue
└── stores/useMeasureStore.ts

MeasureTool.vue imports the store using the configured alias:

<script setup lang="ts">
import { useMeasureStore } from '@/stores/useMeasureStore';

const measureStore = useMeasureStore();
</script>

Steps:

  1. Open the workspace in VS Code.
  2. Index the workspace with CodeGraphy.
  3. Open the Relationship Graph.
  4. Inspect the File Nodes for MeasureTool.vue and useMeasureStore.ts.

Actual behavior

No Relationship is created between:

src/components/MeasureTool.vue
src/stores/useMeasureStore.ts

However, a relative import such as:

import { createKMZHandlers } from './MapIO';

creates the expected Relationship.

Expected behavior

CodeGraphy should read the nearest tsconfig.json or jsconfig.json, resolve the configured compilerOptions.paths, and create the appropriate import and call Relationships.

External package imports such as vue or pinia should continue to be treated as external packages rather than workspace files.

Environment

  • CodeGraphy: 5.16.4
  • OS: Windows
  • Project type: Vue 3 + TypeScript + Vite

Acceptance criteria

  • Vue SFC imports using @/* path mappings resolve to the correct workspace File Node.
  • JavaScript and TypeScript imports use the same path-mapping behavior.
  • Static imports, dynamic imports, reexports, and imported calls receive the resolved path.
  • Windows paths are normalized so resolved paths match indexed File Nodes.
  • Relative import behavior remains unchanged.
  • Bare external package imports do not resolve to workspace File Nodes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions