If you are looking just to remove the component from your local workspace, head to Removing components.
Deleting components in Bit requires a careful approach to ensure integrity and avoid unintentional disruptions in dependent projects.
By default, components are soft deleted, i.e. marked as deleted
without being fully removed, ensuring they remain accessible to dependent components.
To delete components in your workspace, run the following command:
Run the following command to recover a removed component (specify the full component ID):
The output should display the following:
The recovered component is imported to your workspace. It's status is modified
since it is not longer configured as deleted
.
Tag and export it to make it visisble and available again in the remote scope.
Deleting components in a Lane, removes the component from the lane itself. It does not, by default, delete the component entirely from the main lane. The effect is to revert any changes made to that component in the lane.
note
If you still depend on the deleted component in that lane, you will need to install it as a package bit install <component-package-name>
To propagate the deletion to the main lane, i.e. to fully delete the component from the scope (which will take effect only when the lane is merged to main), add the --update-main
flag:
Run the following command to remove a component from a remote scope permanently (specify the full component ID):
warning
Permanently deleting components might cause issues as dependents won't be able to use the component.
Prefer bit delete
or bit deprecate
components instead ensure safe deletion of components.
You can delete a specific component version or an entire semver range using the range
flag:
bit delete hello-world --range 1.1.2