garronej/tss-react

yarn install with pnp mode complains about missing dependency @mui/material

mx-bernhard opened this issue · 3 comments

When running yarn in pnp mode, resolution to dependencies is only possible when declared in the corresponding package.json. Currently tss-react is missing a peerDependency entry for @mui/material. When tss-react accesses said package, the following error is thrown from inside the webpack build:

[build 11/11] RUN ["yarn", "build:release"]
9.430 Creating an optimized production build...
44.56 Failed to compile.
44.56
44.57 Module not found: Error: Can't resolve '@mui/material/styles' in '/build/.yarn/__virtual__/tss-react-virtual-ba2b414d2e/0/cache/tss-react-npm-4.9.0-94adf03371-ffdcdadbce.zip/node_modules/tss-react/esm/mui'
44.57
44.57
ERROR: process "yarn build:release" did not complete successfully: exit code: 1

Hi @mx-bernhard,

Thankd for reporting but sheesh!
That sucks, MUI isn't actually a peerDepencency of tss-react.
tss-react is it's own thing and it can very well be used without MUI.
It's only required to have @mui/material if you are using the specific tss-react/mui preconfigured for the library.

Well, watever, I guess I'll just mark MUI as optional peer dep. It's already what I do with @emotion/server anyway so I should do it anyway for consistency.

I'm releasing 4.9.2. It should fix the issue.

Works for us.