sanity-io / sanity

Sanity Studio – Rapidly configure content workspaces powered by structured content
https://www.sanity.io
MIT License
5.26k stars 426 forks source link

Validate/extract schema fails when there is a url import in `sanity.config.ts` #7602

Open silvertech-daniel opened 3 weeks ago

silvertech-daniel commented 3 weeks ago

Describe the bug

Importing a theme from https://themer.sanity.build/api/hues in sanity.config.ts causes an error like

Error: Failed to load configuration file ".../sanity.config.ts":
Cannot find module 'https://themer.sanity.build/api/hues?...'
Require stack:
- .../sanity.config.ts
- .../node_modules/sanity/lib/_chunks-cjs/getStudioWorkspaces.js
- .../node_modules/sanity/lib/_internal/cli/threads/extractSchema.js
    at Module._resolveFilename (.../node_modules/esbuild-register/dist/node.js:4794:36)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at Object.<anonymous> (.../sanity.config.ts:9:23)
    at Module._compile (.../node_modules/esbuild-register/dist/node.js:2258:26)

Expected behavior

Versions

> npm -v
10.8.3
> node -v
v22.9.0
> npx sanity versions
@sanity/cli (global)    3.59.1 (up to date)
@sanity/asset-utils      1.3.0 (latest: 2.0.6)
@sanity/icons            3.4.0 (up to date)
@sanity/react-loader    1.10.7 (up to date)
@sanity/schema          3.59.1 (up to date)
@sanity/ui               2.8.9 (up to date)
@sanity/vision          3.59.1 (up to date)
@sanity/visual-editing  2.1.10 (up to date)
sanity                  3.59.1 (up to date)
devinhalladay commented 4 days ago

@silvertech-daniel did you find a workaround?

silvertech-daniel commented 4 days ago

@devinhalladay I got through this by vendoring the file