I have a NX monorepo with the following structure:
apps/
├── api/
│ ├── src/
│ ├── tsconfig.json
│ └── tsconfig.lib.json
└── client/
├── src
├── tsconfig.json
└── tsconfig.lib.json
libs/
├── api/
│ ├── src/
│ ├── tsconfig.json
│ └── tsconfig.lib.json
├── ui/
│ ├── src/
│ │ ├── button/
│ │ │ ├── index.ts
│ │ │ └── Button.tsx
│ │ └── ...
│ ├── tsconfig.json
│ └── tsconfig.lib.json
└── shared/
└── ...
tsconfig.base.json
``` tsconfig.base.json { "compilerOptions": { ... "rootDir": ".", "baseUrl": ".", "paths": { "@name/api": ["libs/api/src/index.ts"], "@name/ui/": [ "libs/ui/src//index.ts" ], }, "exclude": ["tmp"] }
tsconfig.json { "compilerOptions": { ... }, "references": [ { "path": "./tsconfig.lib.json" } ], "extends": "../../tsconfig.base.json" }
tsconfig.lib.json { "extends": "./tsconfig.json", "compilerOptions": { ... }, "include": ["src//*.js", "src//.jsx", "src//.ts", "src/*/.tsx"] }
```
All components are exported via index.ts
if it needs to be exposed to other projects.
TS keeps complaining about the path for @name/ui/*
giving this error multiple times:
File '/workspace/libs/ui/src/*/index.ts' not found.
The file is in the program because:
Root file specified for compilation
I did some basic research and I think putting a file after a wildcard is valid, and the code does work. I just hope I can get rid of this specific error. Any help is appreciated!
Subreddit
Post Details
- Posted
- 1 year ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/typescript/...