Linking Workspaces

During local development sometimes you will want to check the changes to your components in projects outside of your workspace. To do so, you can leverage the bit link command with the --target option. The target option should be a relative path to the project where you want your components to be linked to. For example:

bit link --target=../my_project
CopiedCopy

This will symlink all your components to the node_modules directory of your project.

node_modules
  @myorg
    button -> ../../my_workspace/node_modules/@myorg/button
    card -> ../../my_workspace/node_modules/@myorg/card
CopiedCopy

Handle peer dependencies

If your components rely on peer dependencies, it is important that both your components and the components that are present in the target directory use the same peer dependency. Hence, the peer dependencies should be symlinked to the target project too. This can be done by including the --peers option:

bit link --target=../my_project --peers
CopiedCopy

If your components rely on React, this will be the node_modules of the target project:

node_modules
  @myorg
    button -> ../../my_workspace/node_modules/@myorg/button
    card -> ../../my_workspace/node_modules/@myorg/card
  react -> ../../my_workspace/node_modules/react
CopiedCopy

Linking between Bit Workspace

For Bit workspaces there's no need for linking components, as you have all requirements for simply import a component directly to where you want to modify it, and have a more simplistic developer experience.

Bit knows to take care of the build flow and complete dependency graph for the imported components, which means you only need to run the following:

bit import my-org.scope/my-component
CopiedCopy

Once you are satisfied with the changes, the imported component will be a part of the lane you are working on.