You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Their reply sent me down a rabbit hole, and I think what I've learned is that you should not spawn a server in the Vite configureServer hook, because it looks like Vite's resolveConfig() API calls configureServer() internally.
So every time an outside tool merely resolves the Vite config, a Wrangler dev server starts and never exits.
In the case of the Nx Vite plugin, which regularly resolves the Vite config, this causes an unstable dev environment with frequent crashes, due to memory and port exhaustion.
My best idea so far is to write a test with a mocked Wrangler module that just throws an error, then call Vite's resolveConfig() API and make sure it resolves. Let me know if that sounds like the right idea or if there's a better way.
From there, a fix is "just" a matter of figuring out which Vite hook is the right one to use to start Wrangler. I think it might be buildStart but I'm not sure.
The text was updated successfully, but these errors were encountered:
Their reply sent me down a rabbit hole, and I think what I've learned is that you should not spawn a server in the Vite configureServer hook, because it looks like Vite's resolveConfig() API calls configureServer() internally.
I don't think resolveConfig calls configureServer internally. This is more likely because React Router calls vite.createServer in configResolved to create a child compiler.
We just published version 7.2.0-pre.2 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!
I'm using React Router as a...
framework
Reproduction
I don't have one yet. I think a failing unit test will be the best way, but I will need feedback on how to write it first.
System Info
Used Package Manager
pnpm
Expected Behavior
If my Vite config contains the React Router Vite Cloudflare plugin, and I call Vite
resolveConfig()
, the plugin should not spawn aworkerd
process.Actual Behavior
Apparently it does spawn a
workerd
process, as I reported to Nx here:nrwl/nx#28892
Their reply sent me down a rabbit hole, and I think what I've learned is that you should not spawn a server in the Vite
configureServer
hook, because it looks like Vite'sresolveConfig()
API callsconfigureServer()
internally.So every time an outside tool merely resolves the Vite config, a Wrangler dev server starts and never exits.
In the case of the Nx Vite plugin, which regularly resolves the Vite config, this causes an unstable dev environment with frequent crashes, due to memory and port exhaustion.
My best idea so far is to write a test with a mocked Wrangler module that just throws an error, then call Vite's
resolveConfig()
API and make sure it resolves. Let me know if that sounds like the right idea or if there's a better way.From there, a fix is "just" a matter of figuring out which Vite hook is the right one to use to start Wrangler. I think it might be
buildStart
but I'm not sure.The text was updated successfully, but these errors were encountered: