Skip to content

Add custom path aliases (@/components, @/lib) in tsconfig.json #265

@AlAfiz

Description

@AlAfiz

Description

Relative imports like import Button from '../../../../components/ui/Button' are fragile, ugly, and make refactoring difficult. We must use absolute path aliases.

Acceptance Criteria

  • Update the compilerOptions.paths in tsconfig.json.
  • Add aliases for common directories: "@/*": ["./src/*"], "@components/*": ["./src/components/*"], "@lib/*": ["./src/lib/*"].
  • Refactor the existing codebase to replace relative imports with the new absolute aliases.
  • Ensure Next.js and ESLint configurations respect these aliases so they don't throw "module not found" errors.

Technical Details

  • If using a monorepo structure (like Turborepo), ensure cross-workspace imports are handled cleanly through package.json exports rather than deep path aliases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions