-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(core): project linking concept and recipe #29652
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
View your CI Pipeline Execution ↗ for commit e154593.
☁️ Nx Cloud last updated this comment at |
|
||
### Set Up Package Manager Workspaces | ||
|
||
The configuration for package manager workspaces varies based on which package manager you're using. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you mention the package.json linking in the various tabs since PNPM has a different protocol. Can we bring it up more clearly though that for the "workspaces" based pacakge linking you need to have the dependency to the packages defined in the project's package.json
?
like if A -> B
then A
's package.json
needs to have a dependency to B
.
I know in theory NPM (and maybe yarn and bun) don't strictly require this, while PNPM (and yarn pnp?) do. But I'd almost lean towards defining it so things don't go wrong.
"compilerOptions": { | ||
// Required compiler options | ||
"composite": true, | ||
"declaration": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also add declarationMaps: true
.
## Project Linking with TypeScript Path Aliases | ||
|
||
{% callout type="warning" title="Incompatible with TypeScript Project References" %} | ||
You can not use TypeScript project references with this style of project linking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is technically not correct.
You can use TS path aliases with project references. The former is for the name resolution while the latter defines how TS creates "programs" for type checking/compilation.
Now, while possible, it's not what we recommend for sure. We should somewhere mention though that the recommendation goes:
- Workspaces + proj references (preferred for new workspaces)
- TS path aliases (how Nx does it now and will still be valid for a long time)
Adds two pages: