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

Runtime error when building and starting sanity studio locally #243

Closed
eFFeeMMe opened this issue Aug 22, 2023 · 4 comments
Closed

Runtime error when building and starting sanity studio locally #243

eFFeeMMe opened this issue Aug 22, 2023 · 4 comments

Comments

@eFFeeMMe
Copy link

eFFeeMMe commented Aug 22, 2023

TL;DR: importing @sanity-typed/types functions rather than their official Sanity equivalents causes a runtime error when locally browsing the built version of the studio.

Hello, I've run into a problem I can't meaningfully debug myself, so I created a minimal repo for reproducing the issue.

https://github.com/eFFeeMMe/sanity-typed-types-runtime-error

  1. git clone git@github.com:eFFeeMMe/sanity-typed-types-runtime-error.git && cd sanity-typed-types-runtime-error
  2. pnpm build && pnpm start
  3. Browse localhost:3333
  4. You should run into the following runtime error:
Uncaught error: de.default.div is not a function
http://localhost:3333/static/sanity-36aff67c.js:4224:40135
TypeError: de.default.div is not a function
    at http://localhost:3333/static/sanity-36aff67c.js:4224:40135
    at http://localhost:3333/static/sanity-36aff67c.js:6947:53991

To check whether this is a fluke:

  1. git checkout without-sanity-typed-types && pnpm build && pnpm start
  2. Browse localhost:3333
  3. You shouldn't get a runtime error

For clarity, the only difference between main and without-sanity-typed-types is importing Sanity defaults rather than their @sanity-typed/types equivalents.

I'll be honest, I've looked at the code but I've no idea how using your defineField instead of Sanity's default could provoke such a runtime error.

Either way, thanks for the library 🙇

@saiichihashimoto
Copy link
Owner

I have no idea! I know nothing about pnpm, so if it's causing the issue, I wouldn't know. I'm guessing it's contributing because I'm getting this issue:

image

The version of typescript is off.

Also not sure where you're getting the error, because both branches are building/running locally for me, besides having to npm install --force to get past the previous error. Again, I think pnpm is contributing to the issue here.

@vkuprin
Copy link

vkuprin commented Aug 29, 2023

Which pnpm version you have?

@saiichihashimoto
Copy link
Owner

@vkuprin if you're talking to me, I don't have pnpm. I haven't tested this library against pnpm, so we don't currently support it. Hard to determine if this ticket is a pnpm issue or an actual issue without @eFFeeMMe updating the library to use npm instead.

@saiichihashimoto
Copy link
Owner

Please update the repo with standard npm install ie package-lock.json and, if the issue persists, come back and I'll reopen the repo. I'd go ahead and say we don't currently support pnpm, nor have the bandwidth to identify if that's where this issue is coming from. @eFFeeMMe

@saiichihashimoto saiichihashimoto closed this as not planned Won't fix, can't repro, duplicate, stale Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants