-
Notifications
You must be signed in to change notification settings - Fork 16
Closed
Description
I want to setup path aliases in packages (import from ~/...) to replace relative imports with aliased imports.
Heer's my configs:
// packages/ui/package.json
{
"name": "@workspace/ui",
"type": "module",
"exports": {
"./*": "./src/*"
},
...
}// packages/ui/tsconfig.json
{
...,
"compilerOptions": {
...
"paths": {
"~/*": [
"./src/*"
],
},
}
}Inside the ui lib package, everything seems fine, no errors whatsoever. But as soon as I import a UI component in my Remix app, I'm getting TS errors:
../../packages/ui/src/components/Button/index.tsx:2:22 - error TS2307: Cannot find module '~/components/Slot' or its corresponding type declarations.
2 import { Slot } from "~/components/Slot";In my case, Button imports Slot from ~/components/Slot.
If I import from "../Slot"; all is fine again as it doesn't use alias anymore.
Also components that don't import other components or utils don't throw the error.
I am not using tsup.
Am I missing something obvious? Or is this not supported at all? It's probably not a limitation on Remix side, but rather on TS/monorepo.
Metadata
Metadata
Assignees
Labels
No labels