【发布时间】:2021-04-27 03:08:37
【问题描述】:
React 开发相当新,我想在我的应用程序中使用包含一些干净的图标,所以我决定使用 Material-UI 图标,但是我想使用 CDN 而不是在应用程序中安装库。
我从网站上复制了这个 CDN 链接并将其放在 public/index.html
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" /><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" /><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" /><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
问题:尝试在我的 react 应用中使用 Material-UI CDN,但出现错误。
Failed to compile.
Module not found: Can't resolve '@material-ui/icons/ArrowDropDownRounded'
这是什么意思?
【问题讨论】:
-
您能告诉我们您是如何实现图标的,并附上代码供参考吗?从您附加的内容来看,除了您没有安装 @material-ui/icons 包之外,它没有暗示任何其他内容。
-
查看已经解决的解决方案here
标签: reactjs