Open eltigerchino opened 4 months ago
how are other frameworks handling this?
other frameworks usually have wrangler
as a peer dependency, or only have the wrangler
(peer) dependency in their Cloudflare specific adapter packages.
For example:
@remix-run/dev
package):
https://github.com/remix-run/remix/blob/8f6e21f0a740b245d5283090a42c2b7542720245/packages/remix-dev/package.json#L101wrangler
as a simple dev dependency but instruct developers to install it): https://github.com/pi0/nitro-cloudflare-dev?tab=readme-ov-file#usage)wrangler
in any way but allow you to provide the binding proxies in the vite config, you can then populate such using wrangler
: https://qwik.dev/docs/advanced/vite/#platformand is this even worth pursuing?
personally I would say that it might not be, since it only applies to your Cloudflare specific adapters (and if people use those they might as well get access to the proper platform variables)
(the only noticeable negative being stackblitz... but I am not sure how many developers use stackblitz with SvelteKit and Cloudflare, it doesn't feel to me like a common/core use case)
if you do want to reap out the wrangler
dependency you could do what nitro/nuxt is doing, basically by not including wrangler
as a peer dependency, and simply trying to dynamically import the getPlatformProxy
and define a fallback behaviour if wrangler
is not present/the import fails (for example by presenting an error to the user and returning a no-op version of the platform proxy)
https://github.com/sveltejs/kit/issues/12049 is a related issue. The adapter isn't able to build on Alpine.
Describe the problem
Currently, we use wrangler to emulate the
event.platform
variable for cloudflare bindings, etc during development.But the
wrangler
package is pretty big and is not exactly essential if you're not planning on using any of the cloudflare services such as D1 databases, etc. (which is unlikely) or if you're just creating a quick repro on stackblitz. This makes dependency install times much longer (potentially affecting CI/CD for builds and tests? I'm not well versed in that area).Additionally, your app simply won't run on environments such as stackblitz where workerd is not supported. https://stackblitz.com/edit/sveltejs-kit-template-default-rnvvem?file=svelte.config.js
cc: @dario-piotrowicz how are other frameworks handling this? and is this even worth pursuing?
Describe the proposed solution
Is it possible for us to make it an optional dependency or a peer optional dependency? Would that prevent it from being installed automatically?
Alternatives considered
Maybe this isn't even worth pursuing and we'd only want the cloudflare adapters to work in environments that can run a workerd emulation by wrangler.
Importance
nice to have
Additional Information
No response