Skip to content

Typegen error - Failed to load configuration - sanity.defineLocaleResourceBundle is not a function #8646

Open
@theolvq

Description

Describe the bug

When running typegen script, I get the following TypeError

TypeError: Failed to load configuration file "<path>/sanity.config.ts":
sanity.defineLocaleResourceBundle is not a function
    at Object.<anonymous> (~/<path>/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@codemirror+theme-on_43559562270dfec2382bb09dbb7873c0/node_modules/@sanity/vision/src/i18n/index.ts:15:44)
    at Object.newLoader [as .js] (~/<path>/node_modules/.pnpm/[email protected][email protected]/node_modules/esbuild-register/dist/node.js:2262:9)
    at extensions..js (~/<path>/node_modules/.pnpm/[email protected][email protected]/node_modules/esbuild-register/dist/node.js:4833:24)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
 ELIFECYCLE  Command failed with exit code 1.

Weirdly, nothing has changed on my end and this happens even on older branches.

To Reproduce

Steps to reproduce the behavior:

  1. Make sure you have the following script in your package.json
    "typegen": "sanity schema extract --enforce-required-fields && sanity typegen generate"
  2. Make sure you have a sanity-typegen.json file correctly setup
  3. run typegen script (in my case pnpm typegen
  4. See error

Expected behavior

Typegen should happen without error

Screenshots
If applicable, add screenshots to help explain your problem.

Which versions of Sanity are you using?

@sanity/cli (global) 3.73.0 (latest: 3.75.0)
@sanity/asset-utils 2.2.1 (up to date)
@sanity/cli 3.74.1 (latest: 3.75.0)
@sanity/color-input 4.0.3 (up to date)
@sanity/eslint-config-studio 5.0.1 (up to date)
@sanity/icons 3.5.7 (latest: 3.6.0)
@sanity/ui 2.11.8 (latest: 2.13.0)
@sanity/vision 3.74.1 (latest: 3.75.0)
sanity 3.74.1 (latest: 3.75.0)

What operating system are you using?
MacOS latest

Which versions of Node.js / npm are you running?

Node v22.13.1
pnpm 10.2.0

Additional context

If I remove the vision plugin from sanity config, the typegen happens without an issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions