Docs

Docs

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

Modifying Imported Components

It's possible to change a component from any consuming project.

When we import a component using Bit, it downloads the source code of the component. Moreover, Bit keeps tracking the files as a component. This allows doing modifications to the component. It's also possible to run build and test tasks for imported components. This is because Bit keeps them isolated from the consumer project. All changes are also tracked, versioned and exported.

For example, if we import and component and then change, we can run bit status and see that the component is modified.

$ bit status
modified components
  > string/pad-left... ok

Version a sourced component

Sharing a modified version of a sourced component is like sharing any modified component. First we need to tag a new version and see that it is isolated. Afterwards we run bit export to share the new version.

$ bit tag string/left-pad
$ bit export bit.utils

Keep local changes

In some cases we want to change a component and keep the modifications local. For instance, when a specific customizations is required locally. With Bit we can do that by importing components, make the changes, and track all files using Git.
Bit still allows fetching remote changes for these components. We can even merge the changes to the modified component.

Replace component with a package

It's possible to replace a sourced component with its corresponding node package. We call this process eject. When we eject a component using Bit, Bit triggers a delete action for the local component, and npm install command to install the package.

To eject a component a component on export:

bit export bit.examples string/left-pad --eject

To eject a component after export:

bit eject string/left-pad

Learn more about exporting and ejecting components here.

  • Version a sourced component
  • Keep local changes
  • Replace component with a package
Docs
bit.dev
bit.devSupportTerms and PrivacySLA
Community
SlackTwitter
More
Star
Copyright © 2022 bit.dev