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

@hiogawa/vite-node-miniflare is no longer maintained #52

Open
Phoenixmatrix opened this issue Jan 2, 2025 · 13 comments
Open

@hiogawa/vite-node-miniflare is no longer maintained #52

Phoenixmatrix opened this issue Jan 2, 2025 · 13 comments

Comments

@Phoenixmatrix
Copy link

Phoenixmatrix commented Jan 2, 2025

As per this comment from the author

Like a couple of other people in discord and on this repo, I've hit a few snags with the Cloudflare template, just to realize that the vite miniflare plugin was just an experiment and doesn't seem like it's very future proof.

While it has its issues, the cloudflare dev proxy from Remix was pretty solid (as long as you understood the difference between developing in Node vs developing in Wrangler/Workerd/Miniflare and the gotchas you might hit). Wrangler's local development experience isn't particularly robust, so I've usually just had my regular dev script that uses Vite, and another script to test in Wrangler when I have a Cloudflare specific issue to debug.

There's also a PR from someone else, #44 to go back to the dev proxy.

But I'm curious if there was a discussion around why the template was moved away from it and toward the miniflare plugin with RR7, considering it's pretty much deprecated.

I'd definitely suggest keeping the Remix Cloudflare dev proxy as the default in Cloudflare templates until something significantly more robust becomes available, even if it has its limitations. At least it works as advertised~

@pierophp
Copy link

pierophp commented Jan 9, 2025

I've opened a similar issue here:

remix-run/react-router#12709

@titong0
Copy link

titong0 commented Jan 15, 2025

Damn that sucks :/, I started migrating a project using this template and found it would constantly crash. Last time I tried, setting up wrangler was a nightmare and HMR was very slow and buggy. Seriously hoping someone braver than me gets into this rabbit hole lol

@brookslybrand
Copy link
Contributor

Short term addressed in #63. I'm going to keep this issue open as a reminder to switch to Vite Environment API when that's feasible (see comment)

Additionally, I believe the Remix team is trying to provide a better alternative to getLoadContext. Once this lands and is officially supported/recommended, I probably want to switch to this. This is how the AsyncLocalStorage approach more or less was supposed to work, but for the dev proxy I couldn't figure out a good way to run the requestHandler with it, since it doesn't seem to be exposed (see this comment for a better explanation)

@Phoenixmatrix
Copy link
Author

Phoenixmatrix commented Jan 17, 2025

Awesome.

Looking at the cloudflare vite plugin thats in the work, I'd just give feedback to be careful there. Running apps in wrangler kindda sucks in term of devex, even in the best of cases (lots of issues around sourcemaps, hot reloads, etc. Even when using it as intended and Vite isn't part of the equation).

My team really likes the "Work in Node locally, test in Wrangler when necessary" workflow because of that, and the existing Remix plugin is wonderful for it, so if it would be possible to keep it supported long term, that would be great (I'd rather not have to fork it!). Then we'd be able to toggle between the 2 plugins depending on where in our workflow we are.

We have a fairly large enterprise Remix/Cloudflare Worker app, and while not perfect, the current Remix v2 workflow is leagues better what we had before, and would be sad to see it get worse.

If the cloudflare vite plugin is really polished, maybe it won't be an issue, but I'm skeptical, just because of Wrangler's limitations.

@brookslybrand
Copy link
Contributor

Yep, that's all understandable. I don't know the long term plan, but I do think we plan to wait and see how things play out with wrangler and Vite Environment API. We prefer dev and prod to be as similar as possible, but in cases like this we're definitely beholden to what Cloudflare gives us.

That all being said, the proxy exists in React Router v7. I have no idea the long term vision for it, but if we plan to deprecate it in a later major version of react-router we won't do so without feeling confident that there's a better alternative solution.

@Phoenixmatrix
Copy link
Author

Yeah, Ive been using the Remix 2 dev proxy with RR7 and it works beautifully.

@brookslybrand
Copy link
Contributor

Yeah, Ive been using the Remix 2 dev proxy with RR7 and it works beautifully.

I think you can just use the RR7 one, I'm pretty sure it's the same

@Phoenixmatrix
Copy link
Author

Oh yeah, sorry, I meant "the one that existed in Remix, but in a RR7 app". Its the same one and is exported from react-router in RR7, totally. We're on the same page here.

@pierophp
Copy link

pierophp commented Feb 3, 2025

@brookslybrand

Cloudflare has released their official Vite plugin:

https://www.npmjs.com/package/@cloudflare/vite-plugin

@brookslybrand
Copy link
Contributor

Nice @pierophp! If anyone wants to checkout if it makes sense to replace the react-router dev proxy plugin and open a PR that would be awesome 🙏

@pierophp
Copy link

pierophp commented Feb 5, 2025

I tried to do this way:

main...pierophp:react-router-templates:main

@brookslybrand Do you have any idea what is missing?

Image

@pierophp
Copy link

pierophp commented Feb 5, 2025

I've found a reference using Hono:
https://github.com/SoraKumo001/react-router-hono-cloudflare-plugin

@pierophp
Copy link

pierophp commented Feb 5, 2025

@brookslybrand I've found an official Cloudflare template:

https://github.com/cloudflare/templates/tree/main/react-router-starter-template

I have an WIP PR based on the official template that is working:
#81

Image

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

4 participants