Open hyldmo opened 1 year ago
sanity graphql deploy
also can't get the environment variables from vite e.g: import.meta.env.SANITY_STUDIO_API_PROJECT_ID
which is fine in sanity deploy
but not in sanity graphql deploy
.
sanity graphql deploy
also can't get the environment variables from vite e.g:import.meta.env.SANITY_STUDIO_API_PROJECT_ID
which is fine insanity deploy
but not insanity graphql deploy
.
As of v3.2.4 you should be able to use environment variables through process.env
for CLI configuration and such. Other custom vite configurations like aliases and similar are still not available, unfortunately.
@rexxars excellent, thank you.
It might be unrelated, but I'm seeing the same issues with running "type": "module"
(pure ESM), where sanity graphql deploy
is not recognizing ESM imports.
I'm using Sanity v3 here; I'm seeing this issue in both of these repositories:
adding to this: the same issue seems to be present in sanity exec
. the vite config is ignored; consequently, path aliases are undefined, resulting in aliased imports (like ~/lib
in OP) not resolving.
Is there any roadmap for this bugfix? We also have import aliases set up, and it's a huge pain to undo them only for sanity graphql deploy
A bit off-topic, but I have recently swapped over all of my GraphQL queries instead to use https://github.com/FormidableLabs/groqd as I was just having too many issues with GraphQL and complex portable text types. Has been working well thus far.
Describe the bug
Similar to how webpack config is ignored in v2 (see #3092), in v3
sanity graphql deploy
now instead ignores the vite config, and as such I am not able to use import aliases (and probably other features too) if I want to deploy the graphQL API.Here's the error message I'm currently getting:
Here's my
sanity.cli.ts
:Everything works fine while running
sanity dev
,sanity build
, andsanity deploy
To Reproduce
Steps to reproduce the behavior:
Create project and use alias imports.
Expected behavior
A successful deploy without import errors
Which versions of Sanity are you using?
What operating system are you using?
MacOS 13.0.1
Which versions of Node.js / npm are you running?
Run
npm -v && node -v
in the terminal and copy-paste the result here.