Can't resolve react-icons after Sanity upgrade

6 replies
Last updated: Nov 29, 2025
I just upgraded Sanity, and I get compilation errors for all the react icons, e.g. :
Error: Can't resolve 'react-icons/lib/io/android-color-palette'.
Can these not be used anymore?
AI Update

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:

  1. Find the correct icon component name: The path android-color-palette becomes IoAndroidColorPalette in camelCase with the icon set prefix (Io for Ionicons)

  2. 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'
  3. Common icon set prefixes:

    • react-icons/ioIo prefix (Ionicons)
    • react-icons/faFa prefix (Font Awesome)
    • react-icons/mdMd prefix (Material Design)
    • react-icons/hiHi prefix (Heroicons)
    • react-icons/aiAi prefix (Ant Design)
    • react-icons/bsBs prefix (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 thread
6 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.

Was this answer helpful?