Sanity: Can't resolve 'react-icons/lib/md/code' in code-input

Created on 8 Jan 2019  路  8Comments  路  Source: sanity-io/sanity

There seems to be an unmet dependency in code-input causing it to fail

```Failed to compile.

Error in ./node_modules/@sanity/code-input/lib/schema.js
Module not found: Error: Can't resolve 'react-icons/lib/md/code' in '/sanity/node_modules/@sanity/code-input/lib'
@ ./node_modules/@sanity/code-input/lib/schema.js 10:35-69
@ ./node_modules/@sanity/code-input/lib/schema.js (all:part:@sanity/base/schema-type)
@ ./schemas/schema.js (part:@sanity/base/schema)
@ ./node_modules/@sanity/default-layout/lib/components/DefaultLayout.js
@ ./node_modules/@sanity/default-layout/lib/components/DefaultLayoutContainer.js (part:@sanity/base/root)
@ ./node_modules/@sanity/base/lib/components/SanityRoot.js (part:@sanity/base/sanity-root)
@ ./node_modules/@sanity/server/lib/browser/entry-dev.js
@ multi ./node_modules/react-hot-loader/patch.js ./node_modules/normalize.css/normalize.css ./node_modules/@sanity/server/lib/browser/entry-dev.js```

Bug

Most helpful comment

Stumbled on same error today, when I started a project from sanity-gatsby-blog.
Also, the docs still seem to use the old import style?

All 8 comments

I hit the same issue. Looks like react-icons has changed their API. The correct import might be

import { MdLocalMovies } from 'react-icons/md';

However, even with the updated import path, no icon would appear in the content studio. Please help investigate.

You can see from the react-icons official doc: https://react-icons.netlify.com
Here is a migration guide for v2 -> v3: https://github.com/react-icons/react-icons#migrate-from-version-2---3
Your doc needs an update as well: https://www.sanity.io/docs/the-schema/icons-for-data-types

Fixed in v0.140.9

Stumbled on same error today, when I started a project from sanity-gatsby-blog.
Also, the docs still seem to use the old import style?

Have the same issue

Same issue, won't work with Gatsby.js

is this fixed? Im getting the same Error: Can't resolve 'react-icons/lib/md'

is this fixed? Im getting the same Error: Can't resolve 'react-icons/lib/md'

Which version of @sanity/code-input are you using?

is this fixed? Im getting the same Error: Can't resolve 'react-icons/lib/md'

Which version of @sanity/code-input are you using?

Sorry maybe I'v commented in the wrong place. I'm not using @sanity/code-input at all. I'm using the react-icons in my studio. And just to be clear it was working until I upgraded to the latest version (2.0.5, 2.0.6, 2.0.7, 2.0.8) of sanity yesterday

Was this page helpful?
0 / 5 - 0 ratings