jshttp / negotiator

An HTTP content negotiator for Node.js
MIT License
309 stars 33 forks source link

stop lazy loading modules #60

Closed nlf closed 2 years ago

nlf commented 3 years ago

the lazy loading here caused us some minor grief when introducing this module to the npm CLI. the modules that are being lazy loaded do not have any requires of their own and are comprised of largely function definitions, which are pretty cheap in the grand scheme of things.

feel free to close this if the micro optimization is worth it for you! we just wanted to see if we could get this changed here instead of our current hacky workaround: https://github.com/npm/make-fetch-happen/pull/50

dougwilson commented 3 years ago

Hi @nlf thank you for the pull request. I agree, the lazy loading doesn't really add any value. I was curious when it was originally introduced and it looks like it was the time between our org ownership in commit https://github.com/jshttp/negotiator/commit/a3ceee50bbff78b6ee917609dc369baff1ced7be

I'll get this kicked out in a new release for you to consume upstream :)

dougwilson commented 3 years ago

Oops, as quickly as I posted that I realized that was just when require was made to be a dynamic variable. I guess I'm just very sleepy right now 😴 . Anyhow, yes, no need for lazy loading 👍

nlf commented 3 years ago

thanks @dougwilson!