Install Components

Components once exported to a remote scope can be consumed in any other project/app with the package manager of your choice.

npm install @my-org/
yarn add @my-org/

You may also use Bit to install components:

bit install @my-org/

Once installing the component, the component resides in the node_modules directory.

To use the component in the code, import the code as follow:

import { myComponent } from '@my-org/';

Authenticate package manager with

When using for hosting components, consumers will need to configure their package manager to know where to fetch components from. Do this by configuring .npmrc file:

  1. First of all - install Bit on your system.
  2. Run the following command:
bit login
  1. Bit generated a .npmrc in your user-home directory (~ in macOS/Linux, %USERPROFILE% in Windows) with a basic config containing your authentication token.
  2. Open the .npmrc file and add the following line (complete the account name according to where components are hosted)

An example configured .npmrc file looks something like this:


For Self-hosted Components

When self hosting Bit on your own server you need to publish the components as packages to any package registry. The authentication process for the package manager is very much the same other then the fact you can't use bit login to set your token.