Docs

Docs

  • Try Bit next-gen (beta) ⮕
  • Docs
  • Tutorials
  • Guides
  • Github

›Components

Introduction

  • Quick Start
  • Installation
  • How bit Works?
  • Bit Workspace
  • FAQ

Components

  • Tracking
  • Compiling
  • Testing
  • Versioning
  • Documenting
  • Exporting
  • Removing & Deprecating
  • Installing
  • Importing
  • Viewing

Advanced

  • Dependencies
  • Overrides
  • CI & Deployment
  • Bit Server

bit.dev

  • Functionality
  • Account
  • Authentication

Reference

  • Bit Client Configuration
  • Workspace Configuration
  • CLI Commands
  • Usage Analytics

Extending Bit

  • Extending Bit
  • Using Extensions
  • Developing Extensions
  • Build a compiler
  • Build a tester
Edit

Installing

Use installed component

To use a component, you can use the bit install command or a package manager installation:

npm install @bit/owner.scope.namespace.namespace.comp-id
or
yarn add @bit/owner.scope.namespace.namespace.comp-id

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 { something } from '@bit/owner.scope.namespace.namespace.comp-id';

If you want to modify the code of the component, you should import the component into your workspace. After modifying the component and re-exporting the change, you can revert to the package mode by using the bit eject command.

Configuring bit registry

Bit supports CommonJS API for consuming components as packages.

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

To configure the registry manually, 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

Installing all Components

To install dependencies for all the imported components use:

bit install

Add the --verbose flag to get detailed output.

You can also install dependencies for a specific component:

bit install foo/bar

If you need to pass extra arguments to npm or yarn, use double dash --, and after it add the additional arguments:

bit import -- --production --no-optional
← Removing & DeprecatingImporting →
  • Use installed component
  • Configuring bit registry
  • Installing all Components
Docs
bit.dev
bit.devSupportTerms and PrivacySLA
Community
SlackTwitter
More
Star
Copyright © 2022 bit.dev