Context
I'm trying to build sharable custom components (i.e. custom library) using Material UI. My project is a mono repository with the following structure:
/<root>
/docs (storybook)
package.json (1)
/packages
/material-ui-<lib>
package.json (2)
package.json (3)
docs
has the following dependencies
(1):
"material-ui-<lib>": "^0.0.1",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/styles": "^4.11.3",
"react": "^16.13.1",
"react-dom": "^16.13.1"
material-ui-<lib>
doesn't have any dependencies
, but the following peerDependencies
and devDependencies
(2):
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/styles": "^4.11.3",
"react": "^16.13.1",
"react-dom": "^16.13.1"
<root>
doesn't have any dependencies
nor devDependencies
related with material-ui
or react
(3).
The main technologies used:
webpack
material-ui
yarn
(with workspaces)storybook
react
typescript
babel
Problem
When I apply a new theme provider on docs
, everything works fine, but the moment I import material-ui-<lib>
, the theme provider gets ignored.
Tries
I understand that @material-ui/styles
is a singleton, so it needs to be addressed as unique. When running yarn list @material-ui/styles
, I only receive 1 module, not multiple.
I would appreciate your help on this issue.