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
{{ message }}
Repository navigation
Commit 71fd3ea
Browse filesBrowse the repository at this point in the historyBrowse files
fix: avoid endless vite processes when Vite is missing
The runner starts Vite through the package manager, for example
`bun x --bun vite`. When the vite package is not installed, Bun and
pnpm look for `vite` on the PATH. There they find the `vite`
executable of this gem, which starts the runner again. Each process
waits for its child, so the processes accumulate without end.
This commit adds a marker variable to the environment of the process
that the runner starts. When `vite build` or `vite dev` sees the
marker, it stops with an error. The error tells the user to install
the JavaScript packages. vite-plugin-ruby removes the marker when Vite
loads, so a process that Vite starts can still run `bin/vite`.
The check runs before `Builder#build`. With the build lock of PR #630,
a later check would deadlock instead of failing. The marker has no
`VITE_` prefix, because Vite copies those variables into
`import.meta.env`.
A check for `node_modules/.bin/vite` is not possible, because Yarn
Plug'n'Play has no `node_modules`. A check of the parent PID does not
work either, because pnpm starts the child through two processes.
With an older vite-plugin-ruby, `vite build` and `vite dev` fail when
a process that Vite started runs them. `DEFAULT_PLUGIN_VERSION` should
move to the next plugin release to prevent this.
0 commit comments