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
With @nx/vite/plugin installed and vite.config.ts referencing the Remix Cloudflare plugin, every time the Nx daemon reads the Vite config file, it spawns a workerd server runtime process that never exits.
As you continue working, the Nx daemon does this again and again until system resources are exhausted.
Expected Behavior
Analyzing a Vite config shouldn't start a dev server.
Steps to Reproduce
Run npx create-remix@latest ./my-app --template remix-run/remix/templates/cloudflare to create a Remix + Vite + Cloudflare app.
I temporarily uninstalled the Nx Console to work around the memory leak, but I noticed Wrangler servers are still being started every time I invoke the Nx CLI, too. Thankfully those server processes seem to exit cleanly, so there's no memory leak at the moment.
I noticed because I was still hitting the 200-port limit on Codespaces. Thankfully I can probably work around that.
So I suspect there are really two issues here:
When Nx reads the Vite config, it inadvertently starts a Wrangler dev server.
When invoked by the Nx daemon, those Wrangler servers hang, causing a massive memory leak.
I don't know why Nx executes the Vite config as opposed to parsing it, but it seems like you need to be able to guarantee that there are no side effects when doing so.
@aaronadamsCA We don't "execute" the confg, we do load it however, using Vite's API for loading the config.
Therefore if a plugin is executing something before a task is actually run that would be something for the plugin itself potentially to manage.
Thanks for the response @Coly010. I filed an issue with the Remix (now React Router) team.
It looks like they start the Wrangler server in their Vite configureServer hook, and it seems like Vite's resolveConfig() API calls that hook internally.
Current Behavior
With
@nx/vite/plugin
installed andvite.config.ts
referencing the Remix Cloudflare plugin, every time the Nx daemon reads the Vite config file, it spawns aworkerd
server runtime process that never exits.As you continue working, the Nx daemon does this again and again until system resources are exhausted.
Expected Behavior
Analyzing a Vite config shouldn't start a dev server.
Steps to Reproduce
npx create-remix@latest ./my-app --template remix-run/remix/templates/cloudflare
to create a Remix + Vite + Cloudflare app.@nx/vite/plugin
.Nx config:
Vite config:
Nx Report
Additional Information
I suspect this might be an issue with the Remix Vite plugin itself, but I'm not sure so I'm starting here.
I tried removing the Vite plugin and using
run-command
but the problem persisted.The text was updated successfully, but these errors were encountered: