如何在 Redwood JS 中使用 MUI?

How to use MUI in Redwood JS?

我想在 Redwood JS 中安装 MUI。但是当我运行项目目录下的命令

yarn add @mui/material

控制台中弹出一个错误提示

error Running this command will add the dependency to the workspace root rather than 
the workspace itself, which might not be what you want - if you really meant it, make 
it explicit by running this command again with the -W flag (or --ignore-workspace- 
root-check).

我一直在搜索文档,但找不到任何东西。

我检查了commands in Redwiid JS,rw setup ui是添加ui库的命令。但是,那里只提到了 Tailwind & Chakra。有没有办法将 MUI 添加为 UI?

Redwood 项目通常创建为 monorepos。来自他们的 website 下的部分:

How it's Organized

Redwood places both the frontend and backend code in a single monorepo.

问题是您可能 运行 yarn add @mui/material 来自项目的根目录,而不是前端 (/web) 项目内部。

在顶层我们有三个目录,api、scripts 和 web。 Redwood 将后端 (api) 和前端 (web) 关注点分离到代码库中各自的路径中。 (Yarn 将这些称为“工作区”。在 Redwood 中,我们将它们称为“侧面”。)当您继续添加包时,您需要指定它们应该进入哪个工作区。例如(不要 运行这些命令,我​​们只是看语法):

yarn workspace web add marked
yarn workspace api add better-fs

在这种情况下,你只需要在前面的 Mui:

yarn workspace web add @mui/material