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

Vite Plugin does not clean up all vite dev servers on close #10400

Open
Derenge opened this issue Jan 10, 2025 · 1 comment
Open

Vite Plugin does not clean up all vite dev servers on close #10400

Derenge opened this issue Jan 10, 2025 · 1 comment

Comments

@Derenge
Copy link
Contributor

Derenge commented Jan 10, 2025

Reproduction

https://stackblitz.com/edit/remix-run-remix-wdqegrhk?file=server.mjs

System Info

All systems

Used Package Manager

npm

Expected Behavior

Closing the Vite dev server should clean up the Remix plugin viteChildCompiler and the routesViteNodeContext

In reproduction, you can see a listener for SIGTERM that is left behind on each close of the vit dev server

Actual Behavior

Closing the Vit dev server only cleans up viteChildCompiler

Plugin clean up:
https://github.com/remix-run/remix/blob/main/packages/remix-dev/vite/plugin.ts#L1514

There is also a routesViteNodeContext created:
https://github.com/remix-run/remix/blob/main/packages/remix-dev/vite/plugin.ts#L1049

which creates its own dev server which is not closed:
https://github.com/remix-run/remix/blob/main/packages/remix-dev/vite/vite-node.ts#L20

@Derenge
Copy link
Contributor Author

Derenge commented Jan 10, 2025

I think the fix is as simple as

      async buildEnd() {
        await viteChildCompiler?.close();
        await routesViteNodeContext.devServer.close();
      },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant