Bit simplifies dependency management for your components. It automatically detects dependencies while giving you granular control over versions and overrides for individual components or groups.
Dependency resolution relies on two configuration files:
- workspace.jsonc: Defines allowed dependency versions within the workspace, primarily for runtime dependencies like lodash or classnames.
- env.jsonc: Configures the component development environment, mostly specifying peer dependencies like React, GraphQL, TypeScript, or Vitest.
To manually manage dependencies, use the bit deps
command. For instance, to add the classnames package to the apps/to-do component, run:
This command defaults to the latest classnames version. You'll see a confirmation message indicating the added dependency and its version in the apps/to-do component's dependency graph.
To add a dependency with a specific semantic version (semver) or range:
While it's recommended to manage peer and dev dependencies through your component's development environment configuration file, you can directly set them using the --peer
or --dev
flags:
To set a dependency for a group of components using a glob pattern:
Force remove specific dependency for a component:
To reset all manually configured dependencies for a component: