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

SvelteKit & GraphQL Modules #630

Closed
jycouet opened this issue Nov 26, 2021 · 2 comments
Closed

SvelteKit & GraphQL Modules #630

jycouet opened this issue Nov 26, 2021 · 2 comments

Comments

@jycouet
Copy link

jycouet commented Nov 26, 2021

I'm on SvelteKit and to try GraphQL Modules plugin (I'm using the envelop version)

As soon as I add @Injectable({ global: true, scope: Scope.Operation }) on top of my provider class, SvelteKit tell me that he can't handle this.

[vite] Error when evaluating SSR module

In the end, I found that building the context on Ez side is very nice (and typed) so I will not use this way of providers. But if it's not working maybe it should be written in the doc as a limitation? (I could PR the doc if you want)
▶ I'm maybe wrong, and it should work. let me know.

I use mainly GraphQL Modules to organize well my code, and I have a pretty good result.
I will record a video to explain a bit the idea, hope you will like it 🤞.
I have a few ideas to enhance [modules / dataloader / Context Type], and I'm sure that we can make it happen 😎

@PabloSzx
Copy link
Owner

PabloSzx commented Nov 27, 2021

Sveltekit doesn't use tsc for the transpilation, it uses esbuild, and esbuild doesn't have 1-to-1 decorators equivalent as tsc, that requires type-reflection, which no other than tsc has

evanw/esbuild#104

evanw/esbuild#257

sveltejs/kit#798

a workaround could be possible, that uses tsc to give the compiled javascript to the routes folder, but it's not trivial

@jycouet
Copy link
Author

jycouet commented Nov 27, 2021

Thank you @PabloSzx for this detail 👍
And great work.

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

2 participants