-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Daemon shouldn't spawn server when analyzing Vite config file #28892
Comments
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:
I wonder if this would also explain why so many Nx users experience 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. That said, we do have a workaround: import { cloudflareDevProxyVitePlugin, vitePlugin } from "@remix-run/dev";
import { defineConfig } from "vite";
export default defineConfig({
root: import.meta.dirname,
plugins: [
...(!global.NX_GRAPH_CREATION
? [cloudflareDevProxyVitePlugin()]
: []),
vitePlugin()
],
}); |
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 Thanks for the explanation! |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
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: