Can't resolve react-icons after Sanity upgrade
This issue is actually not Sanity-specific—it's related to react-icons v4 breaking changes where deep import paths like 'react-icons/lib/io/android-color-palette' were removed.
The react-icons library deprecated and removed support for deep imports from the /lib directory in version 4. Previously, you could import icons using paths like:
import Icon from 'react-icons/lib/io/android-color-palette'But this no longer works. The library now requires you to import icons using the top-level icon set imports with proper component names:
import { IoAndroidColorPalette } from 'react-icons/io'How to fix this:
Find the correct icon component name: The path
android-color-palettebecomesIoAndroidColorPalettein camelCase with the icon set prefix (Iofor Ionicons)Update your imports: Change from deep imports to named imports from the icon set:
// Old (broken): import Icon from 'react-icons/lib/io/android-color-palette' // New (correct): import { IoAndroidColorPalette } from 'react-icons/io'Common icon set prefixes:
react-icons/io→Ioprefix (Ionicons)react-icons/fa→Faprefix (Font Awesome)react-icons/md→Mdprefix (Material Design)react-icons/hi→Hiprefix (Heroicons)react-icons/ai→Aiprefix (Ant Design)react-icons/bs→Bsprefix (Bootstrap)
If you're using these icons in Sanity Studio schema definitions (like for document type icons), the same fix applies—just update the import path and use the named export:
// In your schema file
import { IoAndroidColorPalette } from 'react-icons/io'
export default {
name: 'myDocumentType',
type: 'document',
icon: IoAndroidColorPalette,
// ...
}Why this happened: When you upgraded Sanity, it likely updated your dependencies including react-icons to v4+, which introduced this breaking change. The library maintainers removed deep imports to improve tree-shaking and bundle sizes.
You can absolutely still use react-icons—you just need to update your import statements to the new format! The icons themselves haven't been removed, just the way you import them has changed.
Show original thread6 replies
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.