Closed cgil closed 1 year ago
Thanks for the report. I've never tried to use styled-components
with material-ui before (or with tss-react). Would you be able to share more about how you're configuring your project and what packages you have installed?
Are you following these steps https://mui.com/system/getting-started/installation/#with-styled-components and then changing your MUI engine to use styled-components
with Webpack overrides described here https://mui.com/material-ui/guides/styled-engine/? Could you perhaps be able to put together a CodeSandbox demonstrating the issue with a relevant setup?
Perhaps tss-react+emotion are not compatible with MUI being configured to use styled-components
. That wouldn't surprise me, but I'd want to check with the tss-react maintainer to get his thoughts. (I hadn't considered this aspect of choosing tss-react.) If so, that would be a bummer. Changing all styling in mui-tiptap to remove tss-react would be a major effort/change, so I wouldn't be able to work on a resolution anytime soon unfortunately.
Hm, I've tested following MUI's installation instructions above and cannot reproduce the error. I am able to configure MUI to use styled components, based on their example here https://github.com/mui/material-ui/tree/master/examples/material-cra-styled-components-ts, using a local Vite project for convenience. Are you sure you've installed all peer dependencies of MUI's packages and mui-tiptap? Perhaps there's some quirk in your webpack setup.
e.g. here are the slider components from that MUI styled-components demo above, alongside mui-tiptap without issue:
That's odd! I found this link from MUI explaining the mismatch between tss-react and styled-components: https://mui.com/material-ui/migration/migrating-from-jss/#2-use-tss-react
Here's a full CodeSandbox working with styled-components and mui-tiptap, as far as I can tell: https://codesandbox.io/p/sandbox/mui-tiptap-alongside-styled-components-3t8tps
@sjdemartini thanks for the example! It took a while to figure this one out, but the issue was actually with yarn workspaces.
It seems this package depends on tss-react@4.8.3
which appears to have some issue not being hoisted to the root package.
Adding the dependency locally cleaned up the mismatch package issue.
As a side note with yarn 1.22.15, and a fresh install I see this (unrelated to the above) issue.
Thanks for the help and love the wrapper!
Awesome, glad you were able to get it working after all. I'm not sure what would cause the hoisting problem in yarn workspaces with tss-react, but nice that you found a workaround and are able to still use mui-tiptap.
For that warning:
The engine "pnpm" appears to be invalid.
Yeah, I'd seen that before. It's an issue with yarn v1 which is fixed in newer versions of yarn (so they aren't patching in yarn classic): https://github.com/yarnpkg/yarn/issues/7560#issuecomment-753609744
I'll close this issue out for now, but if you have suggestions for how to repro the tss-react hoisting problem, I can see about checking with the tss-react maintainer to investigate resolving that.
Describe the bug
Dependencies from mui-tiptap are conflicting with other dependencies. Specifically there's a conflict when utilizing styled-components with MUI V5, and tss-react from mui-tiptap.
Error:
ModuleNotFoundError: Module not found: Error: Can't resolve '@mui/material/styles'
To Reproduce
Expected behavior
Compatability between tss-react and projects utilizing styled-components
Screenshots
System (please complete the following information):
Additional context
Add any other context about the problem here.