refactor: replace vite-node with Vite's native RunnableDevEnvironment#1716
refactor: replace vite-node with Vite's native RunnableDevEnvironment#1716lisa-assistant wants to merge 6 commits intocedarjs:mainfrom
Conversation
👷 Deploy request for cedarjs pending review.Visit the deploys page to approve it
|
Greptile SummaryThis PR removes the
Confidence Score: 4/5Safe to merge after fixing the Vite server resource leak in NodeRunner.init(). The migration is clean and consistent across both packages. One gap stands out: when NodeRunner.init() determines the environment is not runnable, it throws without closing the already-created Vite server, leaving file watchers open. The parallel code path in exec.js closes the server before throwing, so the fix is straightforward. packages/prerender/src/graphql/node-runner.ts — the init() guard path needs server cleanup before throwing. Important Files Changed
Reviews (2): Last reviewed commit: "refactor: address review feedback + expl..." | Re-trigger Greptile |
| const env = this.viteServer.environments.nodeRunnerEnv | ||
| if (!env || !isRunnableDevEnvironment(env)) { | ||
| throw new Error('Vite environment is not runnable.') | ||
| } |
There was a problem hiding this comment.
If
isRunnableDevEnvironment returns false, this.viteServer has already been created and assigned but is never closed before the error is thrown. This leaves file watchers and potentially a listening port open. exec.js handles the identical guard correctly with await server.close() before throwing — the same pattern should be applied here.
| const env = this.viteServer.environments.nodeRunnerEnv | |
| if (!env || !isRunnableDevEnvironment(env)) { | |
| throw new Error('Vite environment is not runnable.') | |
| } | |
| const env = this.viteServer.environments.nodeRunnerEnv | |
| if (!env || !isRunnableDevEnvironment(env)) { | |
| await this.viteServer.close() | |
| throw new Error('Vite environment is not runnable.') | |
| } |
Summary
vite-nodeis a separate package that replicates functionality now built directly into Vite via the Environment API (introduced in Vite 6, and we're on Vite 7).This replaces
ViteNodeServer+ViteNodeRunner+installSourcemapsSupportwith Vite's nativeRunnableDevEnvironment:Before:
After:
Files changed
packages/cli/src/lib/exec.js— used byyarn cedar exec(script runner)packages/prerender/src/graphql/node-runner.ts— used by prerender's GraphQL node runnerpackage.jsonfiles —vite-nodedependency removedInspired by
remix-run/react-router#14862
🤖 Generated with Claude Code