fix(env): only prepend core tools from Node.js runtime#1974
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
8dd53c7 to
ca3791c
Compare
|
Maybe I should learn https://fengmk2.com/posts/blog-qwin-windows-testing-on-macos carefully haha. |
don't do that, it was slop. I only test on real windows by hand. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 157a94fdc1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
This fix will require us to adapt any new executables added to the bin directory in Node.js in the future, and it will be difficult to spot the problem. Maintaining the current implementation is actually to be expected, since users install the global CLI via |
|
Emm, so let's close it.
@fengmk2 However, I still think there is room to improve the current behavior. Actually, in my opinion, the current I've checked #528, #540. According to them, if I have a chance to re-design the |
|
Alternatively, we could improve this by intercepting |
|
Trace in #1986 |
This could be a follow-up to #1935.
Vite+ now prepends node's bin directory to
$PATH, in this directory, it includes not only core Node.js tools, but other installed tools, likenpm install -g typescript'stsc. It can't be access directly from shells, but this prepending makes it accessible from scripts.Another edge case: if you use Node.js to launch your terminal / editor (like
@liangmi/mo), the shell's$PATHwill include the Node's bin as well. When this runtime's bin is included,npm install -gwill stop prompting users to add bins. Make you can't access this bin anymore after you exist this terminal.After this PR, Vite+ will no longer directly prepend the
bindirectory to the$PATH. Instead, Vite+ will lazily create acoredirectory, including symlinks to Node.js's core tools (npm,node,npx), and prependPATHwith this directory. It makes sure installed tools won't appear and disappear all the time.🤖 Generated with Codex