The workspace.jsonc
file is the control center for your Bit workspace. It lets you customize how components are managed, define shared dependencies, and more.
Here's an example of a workspace.jsonc
file:
{ "teambit.workspace/workspace": { "name": "analytics", "defaultDirectory": "{scope}/{name}", "defaultScope": "company.scope" }, "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { "classnames": "2.3.1", "text-transform": "^0.1.2" } } }, "teambit.generator/generator": { "envs": [ "bitdev.node/node-env", "bitdev.react/react-env" ] } }
Configure your workspace
- name. Your workspace's name.
- icon. Path to an image url to represent your workspace.
- defaultScope. The default scope used for new components created.
- defaultDirectory. Where new components are created (using bit create or bit import). You can use placeholders like "{scope}" and "{name}" to create dynamic paths.
Optimize for performance
Ensure resolveAspectsFromNodeModules
and resolveEnvsFromRoots
are set to true
for optimal development performance in your workspace.
Define shared dependencies for your components. This ensures consistent versions across your project.
{ /** * dependencies configuration. */ "teambit.dependencies/dependency-resolver": { "policy": { "dependencies": { "classnames": "2.3.1", "text-transform": "^0.1.2" } } } }
In this example, all components in the workspace can use classnames
to 2.3.1
and text-transform
to ^0.1.2
.
Additonal dependnecy resolver configuration includes:
- packageManager. Defines the package manager in use. Defaults to pnpm.
- overrides. Forces specific dependencies and their versions to resolve all across dependency graph. Use with cautious.
Dev and peer dependencies are automatically detected and classified for your components and doesn't require a specific mention in your workspace configuration. To set development or peer dependencies head to the development environment configuration.
Configuring component generators provides additonal component templates to use when creating components using bit create.
{ "teambit.generator/generator": { "envs": [ "bitdev.node/node-env", "bitdev.react/react-env", // "bitdev.vue/vue-env", // "bitdev.angular/angular-env" ] } }