Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
51 lines (36 sloc) 1.46 KB
id title permalink redirect_from layout category next
installing-components
Installing Components
docs/installing-components.html
docs/install-components.html
docs
Getting Started
sourcing-components.html

Bit supports CommonJS API for consuming components as packages.

To install components with npm or yarn we first need to configure @bit as a scope registry. Bit does it by default as part of the bit login process.

Configuring Bit as a scoped registry for NPM and Yarn

Note

Bit does this step automatically after a successful bit login.

To configure scoped registry we use the npm config command.

npm config set '@bit:registry' https://node.bit.dev

To install private components use npm login. Use your Bit credentials to login.

npm login --registry=https://node.bit.dev --scope=@bit

To learn more about NPM scoped registries, please refer to NPM's documentation.

Package naming convention

Package naming convention includes the Bit owner, Collection name and the component ID (including namespaces).
For example:

yarn add <owner>.<collection>.<component-ID>

Using a packaged component

After installing the component as a package, import/require it in the following format:

import component from '@bit.<owner>.<collection>.<component-ID>';
You can’t perform that action at this time.