TSConfig Path Alias doesn't resolve in monorepo

Trying to convert my repo to a turborepo, using create-t3-turbo as a baseline. Almost everything worked as expected, until I tried to add custom path aliases inside packages/api. That led to the following error.

../../packages/api/src/trpc/router/meeting/meeting-attendance-link.ts:2:0
Module not found: Can't resolve '@/common/grant-rewards'
  1 | import { applyLinkSchema } from "@meetxl/shared/schemas/link-schemas";
> 2 | import { grantRewards } from "@/common/grant-rewards";
  3 | import { AttendanceLinkAction } from "@prisma/client";
  4 | import { TRPCError } from "@trpc/server";
  5 | import { randomBytes } from "crypto";

Import trace for requested module:
../../packages/api/src/trpc/router/meeting/meeting-attendance.ts
../../packages/api/src/trpc/router/meeting/index.ts
../../packages/api/src/trpc/router/index.ts
../../packages/api/index.ts
./src/pages/api/trpc/[trpc].ts

https://nextjs.org/docs/messages/module-not-found


This is my
tsconfig.json
for the packages/api package:

{
  "extends": "../../tsconfig.json",
  "include": ["src", "index.ts", "transformer.ts"],
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}


The compilerOptions match apps/web exactly, but while it works in apps/web it very much does not work in packages/api.
Was this page helpful?