材质图标似乎缺少依赖项 - @emotion?
我正在按照 google mui.com 上的说明/参考进行操作,但是当我尝试使用它们时我收到 webpack 的错误消息,说我需要名为 @emotion 的东西。
这实际上是必要的吗?如果是的话,为什么当我安装材质图标时不包括它。
npm install @mui/icons-material
mui.com 的说明中没有提及它。
我盲目地安装了 @emotion/react
和 @emotion/styled
并且 webpack 会编译。似乎 React 需要指南中未提及的额外依赖项。
I am following the instructions / reference by google at mui.com, however when I try to use them I get an error by webpack saying I need something called @emotion.
Is this actually necessary and if so why is it not included when I install material icons.
npm install @mui/icons-material
There is no mention of it in the instructions by mui.com.
I blindly installed @emotion/react
and @emotion/styled
and webpack will compile. Seems that react requires extra dependencies not mentioned in the guide.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您需要使用 Material UI 中的图标时,可以使用此语法。
但是,如果您在项目设计中不使用图标,并且确实使用 Material UI 而不是 CSS,则可以使用以下语法安装它们:
但是,从您提到的警告包要求(即@emotion)来判断。然后您可以使用以下语法安装包:
Material UI 默认使用情感作为样式引擎。如果您想改用样式组件。
This syntax is used when you need icons in use from Material UI.
However, if you don't use icons in your project design, and you do use Material UI instead of CSS, you can install them with the following syntax:
However, judging by the warning package requirements mentioned by you, namely @emotion. Then you can install the package with the syntax:
Material UI is using emotion as a styling engine by default. If you want to use styled-components instead.