Totally random, but I want to give a

Totally random, but I want to give a Friday shoutout to the team working on Wrangler and the Vite Plugin. Migrated my (quite large) Remix/RR7 project from the dev proxy plugin to the official Cloudflare plugin some weeks ago, and the experience was...rough (if you scroll up you'll see I was not a happy camper and was afraid I'd have to roll back. It was a big migration for us because we had a lot of assumptions about the proxy plugin in our codebase ๐Ÿ˜†) But over the last few weeks the updates the team did to the plugin fixed the issues with some iteration and discussion on the github repo. We've been running 1.11.2 since it got published and its really solid now. HMR works perfectly, no crash, things run fast and it works as advertised now for everyone in my team. If anyone on the team's ever in the Manhattan area Ill get you drinks ๐Ÿฅณ
6 Replies
Vero
Veroโ€ข2w ago
Hey. Glad to hear that. Was it this we fixed that helped you?: https://github.com/cloudflare/workers-sdk/pull/9993
GitHub
Enable sharing concurrent requests for the same module across invoc...
Fixes #9518. Fix issue that resulted in A hanging Promise was canceled errors when developing large applications. We now handle requests for modules in a Durable Object so that they can be shared a...
Vero
Veroโ€ข2w ago
or was there something else?
Shados
ShadosOPโ€ข2w ago
It seemed to have been a combination of things. Since our app is fairly large and complex, we hit pretty much every possible edge case ๐Ÿ˜† The release that added the hot reload boundary in the entry point helped a lot but HMR still failed some (but less). Then a release in between, not sure which stabilized the crashes we were randomly getting if you saved files too quickly, and made HMR 100% reliable. We still have an issue right now where if we change the wrangler.toml while Vite is running, we get an error about Miniflare not working anymore and need to restart. But we don't mess with the wrangler.toml often enough for me to notice. I didn't fully document, but we went from a 1.8.X to 1.9.X release, to one of the prerelease builds and adding the HMR boundary manually as per one of the recommendation on a github issue, then 1.11.0, and finally 1.11.2, and stuff improved with every one of those release until 1.11.2 made it perfect (except for the wrangler.toml crashing miniflare issue still remaining. Which probably should get fixed by at this point its so minor, its not a big priority for our team.)
James Opstad
James Opstadโ€ข2w ago
Really glad things have improved for you! We've been working hard to address the pain points that only emerge in larger apps. Two areas we would still like to improve further are the start up time in dev and dependency optimisation not always working well. Both of these would potentially be fixed by Rolldown supporting full-bundle mode for server environments so we're pushing for that to happen (https://github.com/rolldown/rolldown/discussions/153#discussioncomment-13888456).
GitHub
Roadmap ยท rolldown rolldown ยท Discussion #153
This roadmap outlines the high-level milestones that we intend to follow as we progress with Rolldown's development, but is subject to frequent adjustment as things go. Milestone 1: Basic Bundl...
Shados
ShadosOPโ€ข2w ago
That's awesome. Yeah slow start time has been a minor issue (it is slow, but now that it doesn't crash anymore we can leave the server running, even when switching branches, etc), so fortunately we've been able to live with it. The dependency optimisation with Vite is an issue thats been driving me nuts even in apps that don't use Cloudflare. Its so finicky even in "vanilla" Vite. One thing for our app (React Router 7) is that RR's unstable_optimizeDeps: true, wasn't adding the entries to the environment in Cloudflare, though that was diagnosed in an older version so I don't know if its a red herring. So we've added the same thing RR7 adds to ours just to be safe. It made a huge difference back then. I have no idea if its still necessary. We've seen twice that after doing a pnpm install the dependencies went through optimization again but that seemed to be a fluke. When it does happen, its slow as hell with the Cloudflare plugin (taking like 15 minutes), which is possibly what you're talking about. As long as all my dependencies are properly discovered on startup I don't have issues.
No description
James Opstad
James Opstadโ€ข2w ago
There were bugs in Vite and React Router related to optimizeDeps.entries that contain special characters (as React Router routes often do) so that might be relevant. These were fixed in Vite 7 and the corresponding version of React Router. Agree that there are often cases where optimizeDeps doesn't work well though.

Did you find this page helpful?