gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
73.49k stars 7.37k forks source link

Improve npx speed #12620

Closed bep closed 3 days ago

bep commented 5 days ago

Resolving binaries with npx seem to have about 200ms overhead, which isn't great ...

See https://github.com/tailwindlabs/tailwindcss/issues/13886

bep commented 5 days ago

So, I have done some research on this and there's no way to cache the path found by npx.[^1]. So what I'm suggesting/doing is:

  1. Check WORKDIR\node_modules\.bin\<binaryName>
  2. Check npx if npx is available.
  3. Check PATH

[^1]: There's npm which, but that triggers a "download prompt", which is not something we can support.