cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.7k stars 710 forks source link

🐛 BUG: C3's Svelte option is really SvelteKit - confusing? #3263

Closed IgorMinar closed 3 days ago

IgorMinar commented 1 year ago

Which Cloudflare product(s) does this pertain to?

C3

What version of Wrangler are you using?

2.0.2

What operating system are you using?

all

Describe the Bug

I'm filing this mostly for posterity and record keeping.

In https://twitter.com/mr_wormhole/status/1658940824468480003 Talha pointed out that we are missing SvelteKit support.

Initially I thought this was a bug, but it turns out that what we call "Svelte" translates to create-svelte npm package which scaffolds a SvelteKit app.

My read on this is that we did the right thing: our guiding principle is that we enable full fidelity of UX/DX control for the framework authors. That includes branding. In this situation that means that we should honor that the Svelte/SvelteKit team decided to call their DX entry-point to scaffolding applications create-svelte which represents Svelte and not SvelteKit.

If the SvelteKit team would like to be represented differently then we'll honor that. We just need an authoritative Svelte representative to comment here while this issue is open or file a new issue on this repo after this issue is resolved.

dario-piotrowicz commented 10 months ago

I just wanted to add that this doesn't only apply to Svelte/SvelteKit but to other frameworks/meta-frameworks as well such as qwik/qwikCity and solid/solidStart

Regardless on whether this is right or potentially confusing and whether it should be changed or not, one thing that I think important here is to keep this consistent with our docs, those currently use the same pattern as C3 does: https://developers.cloudflare.com/pages/framework-guides/ (saying Deploy a Svelte site instead of Deploy a SvelteKit site)

benmccann commented 10 months ago

If the SvelteKit team would like to be represented differently then we'll honor that. We just need an authoritative Svelte representative to comment here while this issue is open or file a new issue on this repo after this issue is resolved.

Hi :wave: Svelte/SvelteKit maintainer here. I just happened to stumble across this while looking for open issues mentioning SvelteKit to see how we can better support Cloudflare. They way we think about it is if you create a new Svelte app that should be a SvelteKit app, but we should also be clear about what's Svelte vs SvelteKit. So we have create-svelte as the way to create a new Svelte app since SvelteKit will be the way to do that for most users, but everywhere in our docs, etc. when we refer to Svelte vs SvelteKit the former is always the UI library and compiler while latter is always the meta framework with router, adapters, etc. So in keeping with that I'd suggest that most references to Svelte in https://developers.cloudflare.com/pages/framework-guides/deploy-a-svelte-site/ (probably including the title) should say SvelteKit and I'd probably go with SvelteKit in the interactive UI from https://twitter.com/mr_wormhole/status/1658940824468480003. The one place where I'd maybe leave it as Svelte is --framework=svelte, but that's just as much to avoid breaking existing tutorials, etc. as it is having any preference for one vs the other there.

I'd also love to connect regarding ways to have SvelteKit and Vite apps work better with wrangler and vice versa. I have to run to a meeting at the moment, but might leave some thoughts here later unless there's a better place to discuss.

benmccann commented 10 months ago

I'd also love to connect regarding ways to have SvelteKit and Vite apps work better with wrangler and vice versa. I have to run to a meeting at the moment, but might leave some thoughts here later unless there's a better place to discuss.

Following up on this, SvelteKit is based on Vite. To run a SvelteKit app for local development you run vite dev. I don't have a lot of familiarity with hosting on cloudflare, but my understanding is that it's expected you run a cloudflare CLI like wrangler or miniflare to test your app. It sounds like this creates a headache for most users who try to use SvelteKit and Cloudflare together since they both want to be the entry point to the application. There's quite a few other frameworks using Vite these days or that have their own CLIs, so I'd be curious to learn if there are any that are doing a particularly good job interacting with the local cloudflare devtools? I don't know if there's any way to decouple things like the key value store from these CLIs? For an analogy, it'd also cause us some difficulty if any MySQL clients had to be run inside a MySQL CLI or if anything that would be deployed to AWS had to run inside an Amazon process for local development. Or maybe miniflare could be made to run as a middleware inside a traditional app server like the one used by Vite. Open to any ideas as I would love to get some ideas on how we might be able to make this development process smoother for users.

dario-piotrowicz commented 10 months ago

@benmccann the local dev situation with Cloudflare and vite dev servers is something that we've been exploring recently

As part of that I've also opened this PR in the SvelteKit repo: https://github.com/sveltejs/kit/pull/11323 (which isn't really having much success I must say 😓) (which you commented on 😜)

I've sent you a friend invite on discord, you can also join the Cloudflare server, if you want let's connect there and discuss how we can better the local dev situation for developers! 🙂

penalosa commented 3 days ago

This was addressed by https://github.com/cloudflare/workers-sdk/pull/7109