mirror of
https://github.com/hanzoai/sign.git
synced 2026-10-21 01:21:51 +00:00
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]>
This commit is contained in:
@@ -13,6 +13,19 @@
|
||||
],
|
||||
"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"],
|
||||
|
||||
Reference in New Issue
Block a user