ibrahim_t
ibrahim_t

Reputation: 11

Bit build throws an error if a component uses external library like Material UI?

My use case:

I have a Button component with Material UI. I want to export that component to bit component, but while compiling the bit build, I get an error on Material UI modules:

error screenshot

How do I isolate a component if it has external library dependencies?

Upvotes: 1

Views: 429

Answers (1)

John Spiteri
John Spiteri

Reputation: 594

You can reference dependencies (and peerDependencies) in the "workspace.jsonc" file like this:

"teambit.dependencies/dependency-resolver": {
  "packageManager": "teambit.dependencies/pnpm",
  "policy": {
    "dependencies": {
      "@angular/router": "13.0.3",
      "@ngrx/effects": "13.0.1",
      "@ngrx/store": "13.0.1",
      "@ngx-translate/core": "14.0.0"
    },
    "peerDependencies": {}
  }
},

Here is the documentation.

Certain use cases need "Compositions" to use building blocks in isolation, mocking how a component would function in a project.

Upvotes: 2

Related Questions