You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
$ sanity schema extract --enforce-required-fields --path=./sanity/extract.json && sanity typegen generate
✗ Failed to extract schema, with enforced required fields
ReferenceError: Failed to load configuration file "C:/Users/<path>/sanity.config.ts":
require is not defined
at file:///C:/Users/<path>/node_modules/lucide-react/dist/cjs/lucide-react.js:1
0:13
":require is not defined at file:///C:/Users/<path>/node_modules/lucide-react/dist/cjs/lucide-react.js:1":
require is not defined
":":
require is not defined
at file:///C:/Users/<path>/node_modules/lucide-react/dist/cjs/lucide-react.js:1
0:13
at Object.newLoader [as .js] (C:/Users/<path>/node_modules/esbuild-register/dis
t/node.js:2262:9)
at extensions..js (C:/Users/<path>/node_modules/esbuild-register/dist/node.js:4
833:24)
error Command failed with exit code 1.
To Reproduce
Steps to reproduce the behavior:
Go to 'schemaTypes/schema.ts'
Click on 'import and use HandPlatter icon'
Open terminal and 'yarn run dev'
See error
Expected behavior
typegen should recognize custom icons and generate types without errors.
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.
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: