Skip to content
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

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

Open
silvertech-daniel opened this issue Oct 7, 2024 · 2 comments

Comments

@silvertech-daniel
Copy link
Contributor

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

  • Avoid attempting to import urls when validating/extracting the schema
  • Warn instead of error if an import fails during the schema validation/extraction
  • Expose a way to configure the module loader

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
Copy link

@silvertech-daniel did you find a workaround?

@silvertech-daniel
Copy link
Contributor Author

@devinhalladay I got through this by vendoring the file

@sgulseth sgulseth added bug KTLO labels Nov 7, 2024 — with Linear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants