-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typegen fails when using custom icons in schema definitions #8718
Comments
I've had this setup working in react 18. If I remember correctly, I had to move to react 18 from 19 to use this (lucide react icons on schema). working setup: // schema/orderType.tsx
import { ShoppingCart } from "lucide-react";
import { defineArrayMember, defineField, defineType } from "sanity";
export const orderType = defineType({
name: "order",
title: "Order",
type: "document",
icon: <ShoppingCart />,
fields: [.... // rest of the schema // schema/index.ts
export const schema: { types: SchemaTypeDefinition[] } = {
types: [blockContentType, categoryType, productType, orderType, salesType],
}; // package.json
"dependencies": {
"@sanity/icons": "^3.5.2",
"lucide-react": "^0.468.0",
"next": "15.0.4",
"next-sanity": "^9.8.25",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sanity": "^3.67.0",
},
"devDependencies": {
"@types/node": "^22.10.1",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
} tbf, sanity warns when you are using react 19 when installing, that some features might not be working. I guess, we just have to wait for now. |
Thanks for your response! |
Describe the bug
When using custom icons (i use lucide-react) in Sanity schema definitions, typegen fails with an Reference Error. Failed to load config file, require is not defined. The custom icon type is not recognized by the type generation tools.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
typegen should recognize custom icons and generate types without errors.
Screenshots
Which versions of Sanity are you using?
What operating system are you using?
Which versions of Node.js / npm are you running?
Additional context
I am using the Markdown plugin in my Sanity schema. I tried disabling and re-enabling the plugin, but the issue persists.
This error did not occur in previous versions of Sanity
. It seems to be related to the recent updates or changes in the type generation process.Here’s how I integrated the Markdown plugin:
Security issue?
No
The text was updated successfully, but these errors were encountered: