Abby
Abby

Reputation: 3199

How do I effectively npm link when using bit.dev?

I have two git repos;

My folders are roughly;

component-library
 |- .bitmap
 |- /src
   |- /button
      |- /button.js
   |- /header
      |- /header.js

next-react-project
 |- /src
   |- /pages
      |- /home.js

I want to be able to see local changes to my components in my react app without having to first tag and export them to bit. Before using bit.dev, i'd do this by running something like npm link ../component-library.

How can I achieve this with bit.dev?

Upvotes: 3

Views: 1083

Answers (1)

Claros
Claros

Reputation: 107

Since bit harmony, bit added a --target flag to the bit link command. The usage is:

bit link --target <path to the destination>

If you want to use it the same way you use npm link and link your packages globally, you can run this command in your workspace:

bit link --target $(dirname "$(npm root -g)")

Then inside the project (your next/react app) where you want to install the package:

npm link <packageName>

Upvotes: 2

Related Questions