Skip to content

Workspace links #485

Answered by darcyclarke
Eomm asked this question in Question
Oct 28, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

There's a couple ways to do this. The first is that you can specify a relative path (if you're working locally) vs. using the name of the workspace (since npm will try to fetch from the registry - as you noticed) or you can you use npm link (ref. https://docs.npmjs.com/cli/v7/commands/npm-link#workspace-usage & https://docs.npmjs.com/cli/v7/using-npm/workspaces). In both cases you'll want to add the dep but not install it. Since we don't have a great way of doing that today, you can use npm pkg set.

Example 1 - relative path

$ npm pkg set dependencies[c]="file:../c" -w a -w b
$ npm install

Example 2 - link

$ npm pkg set dependencies[c]="*" -w a -w b
$ npm link -w c
$ npm link c -w a -w b
…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Eomm
Comment options

Answer selected by Eomm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants