perf(javascript): replace add-node-modules-path

The add-node-modules-path package calls `npm bin` to locate the
node_modules/.bin, and does so while invoking the user's $SHELL, which
can be very expensive depending on the user's shell configuration,
possibly adding seconds to the startup time of any JS/TS file.

To mitigate this, I replace the package with a much faster, and in-house
heuristic. Folks with more complex needs should be using direnv anyway.

Fix: #6878
This commit is contained in:
Henrik Lissner 2022-10-08 18:07:17 +02:00
parent 4bd4b13158
commit d25ff46d46
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
3 changed files with 10 additions and 2 deletions

View file

@ -323,7 +323,7 @@ to tide."
typescript-mode
solidity-mode)
:when (locate-dominating-file default-directory "package.json")
:add-hooks '(add-node-modules-path npm-mode))
:add-hooks '(+javascript-add-npm-path-h npm-mode))
(def-project-mode! +javascript-gulp-mode
:when (locate-dominating-file default-directory "gulpfile.js"))