-
Notifications
You must be signed in to change notification settings - Fork 778
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
🚀 Feature Request: Provide platform features as mock module? #3632
Comments
Could you clarify the specific feature that would be helpful? I think Miniflare's |
Thanks for the issue @leaysgur 🙂 , the idea sounds intriguing but wrangler doesn't really feel the best place to have some sort of proxy like that (if that's what you were suggesting), actually as @penalosa alluded baking in miniflare in devservers and provide an in-process bindings strategy (like the next-on-pages one you mentioned) sounds like a better alternative instead of having to force users to run two different processes and proxy one to the other (potentially introducing new APIs for accessing bindings). We know that the current dev server situation is not optimal and we're trying hard to improve it, hopefully we'll soon find a solution that can be generally used in most dev servers without the need to run extra processes or other such complications. For example one thing that would be very existing would be if we could actually have vite support the workerd runtime natively, that would allow dev servers to just get bindings without the need of any proxying 🙂 (like mentioned in this issue) |
Thanks for your response. I'll leave some notes in the hope that a better solution can be found soon.
And the need to mock the environment locally and the need to use remote data may be two different things. |
Thanks for the comment @leaysgur 🙂 (sorry I only now noticed your comment), duly noted, thanks for the feedback I'll bring it back to the team Regarding your points:
I don't think that
Yes having a single process might not be the simplest thing, but it is usually what people expect nowadays as a good DX so I would really try to go for something like that, that being said, if that becomes a blocker having to run multiple processes can also be feasible (but not an optimal DX in my opinion) Regarding Vite, I was mentioning that (and that's been a focus for the team as well) since it is so prevalent nowadays and most frameworks seem to run on top of it, so having a Vite solution would basically cover a large amount of use cases, yes, not totally ideal and not a solution for everything, but something that could really help a large number of developers 🙂
workerd is already a full runtime in which we can run our code, the biggest issue is that modern dev servers (I'm mainly thinking of Vite 😅) can't run in workerd as they heavily rely on nodejs APIs. We could try to build our own dev server/ecosystem and have something very Cloudflare specific, the issue is that even if we get something good up and running, if it is not going to be easily adaptable to existing frameworks then it might not really provide tangible benefits to users 😕
Yes 🤔, I would assume that we could define a local only solution and then people could still use wrangler to run previews and get access to remove bindings, but I think you're suggesting that that wouldn't be good enough? and that having the ability to quickly iterate over remote data is very useful? |
Don't worry about it. 😉 I very much appreciate your thoughtful reply!
I think that's right, too. So when Vectorize was announced, I was rather surprised that there was no
Agreed. I'm also watching with interest the movement towards this.
Yes. It is fine if you just want to preview, but as soon as you want to debug, it becomes a lot more difficult. Currently, this can be achieved with This was the original reason I developed my module in the first place. Therefore,
These were my motivations for wanting remote data. |
Describe the solution
Hi, I am the author of the
cfw-bindings-wrangler-bridge
module.This was originally implemented to use bindings like KV and D1 even for local development using
vite dev
commands with SvelteKit.Since it uses
wrangler dev
, we can use values from the preview environment as well as locally, which is very useful, at least for me.Other than that, it can also be used to go beyond the current service binding constraints in DX.
Now to the main topic, I recently found a
next-on-pages
project that is trying to do something similar.I wrote this issue because I wondered if the
wrangler
itself could provide a something similar feature.Of course, there are many concerns, feasibility issues, etc... but, what do you think?
The text was updated successfully, but these errors were encountered: