Files
zeekayandHanzo Dev f7ed11c6c3 fix(remix): map server/* so the bare specifiers resolve
`turbo run build --filter=@hanzo/esign-remix` fails its typecheck with

    error TS2307: Cannot find module 'server/utils/get-loader-session'
    error TS2307: Cannot find module 'server/context'
    error TS2307: Cannot find module 'server/router'

All three files exist — apps/remix/server/context.ts, server/router.ts,
server/utils/get-loader-session.ts. The problem is that they are imported as
NON-RELATIVE specifiers, and a bare specifier has no root to resolve against
unless it is named in `paths` or `baseUrl` is set. Neither was true, so tsc
looked for an npm package called `server`.

Added `"server/*": ["./server/*"]` rather than setting baseUrl. baseUrl would
change resolution for every bare specifier in the project, letting any
top-level directory shadow a package of the same name; this maps exactly the
one prefix that needs it. paths-without-baseUrl already works in this config —
the existing `~/*` entry relies on it.

Verified by resolving each specifier through the tsconfig's own path rules:
all three land on the real files. A full tsc run is not possible in a bare
clone (no node_modules — it stops earlier on missing @types/node), so CI is
what exercises the whole typecheck.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-27 18:10:05 -07:00

49 lines
1.9 KiB
JSON

{
"include": ["**/*", "**/.server/**/*", "**/.client/**/*", ".react-router/types/**/*"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"types": ["node", "vite/client"],
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "bundler",
"jsx": "react-jsx",
"rootDirs": [
".",
"./.react-router/types"
],
"paths": {
"~/*": ["./app/*"],
// server/* — app code and the server tree both import these as bare
// specifiers (e.g. `import { getLoaderSession } from
// "server/utils/get-loader-session"`). The files exist at
// apps/remix/server/, but a NON-RELATIVE specifier has no root to
// resolve against unless it is named here or baseUrl is set, so tsc
// reported TS2307 "Cannot find module 'server/context'" for files
// sitting right there and failed `turbo run build`.
//
// A paths entry rather than baseUrl: baseUrl would change resolution for
// every bare specifier in the project, letting any top-level directory
// shadow a package of the same name. This maps exactly the one prefix
// that needs it.
"server/*": ["./server/*"],
"@hanzo/esign-api": ["../../packages/api"],
"@hanzo/esign-assets": ["../../packages/assets"],
"@hanzo/esign-auth": ["../../packages/auth"],
"@hanzo/esign-lib": ["../../packages/lib"],
"@hanzo/esign-prisma": ["../../packages/prisma"],
"@hanzo/esign-trpc": ["../../packages/trpc"],
"@hanzo/esign-ui": ["../../packages/ui"],
"@hanzo/esign-tailwind-config": ["../../packages/tailwind-config"]
},
"esModuleInterop": true,
"verbatimModuleSyntax": true,
"noEmit": true,
"moduleDetection": "force",
"resolveJsonModule": true,
"isolatedModules": true,
"skipLibCheck": true,
"strict": true,
"useUnknownInCatchVariables": false
}
}