Build with Sanity MCP in Replit. Prizes up for grabs! Submit by June 14

Can't resolve react-icons after Sanity upgrade

6 repliesLast 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:

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

Was this answer helpful?

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.

Related contributions