cost-of-modules icon indicating copy to clipboard operation
cost-of-modules copied to clipboard

Feature Request: Ignore Optional Dependencies

Open edm00se opened this issue 7 years ago • 8 comments

It would be nice to have an option to ignore optionalDependencies, which apparently are included with the invoked npm install --production that gets triggered.

edm00se avatar Dec 17 '17 19:12 edm00se

Make sense, would you like to create a PR?

siddharthkp avatar Dec 17 '17 23:12 siddharthkp

I'll put it on my list of "when I have time", but it might be a little while 🤔. I'll see when I can look into it. If I make some progress, I'll update here, but if somebody beats me to it, I'd love to see it implemented.

edm00se avatar Dec 17 '17 23:12 edm00se

@edm00se If you haven't started working on this, I'll take a shot on this today.

zodvik avatar Mar 13 '18 08:03 zodvik

Go for it!

siddharthkp avatar Mar 13 '18 10:03 siddharthkp

Also, oh damn! Hi Bafna!

siddharthkp avatar Mar 13 '18 10:03 siddharthkp

This was a rabbit hole that led to npm/npm#17633. The --no-optional isn't actually working in npm for some time now. I see 2 options

  1. Invoke as --no-shrinkwrap --no-optional as an fix to npm/npm#17633
  2. Parse package.json file to read optionalDependencies

I would prefer 1. if you don't anticipate side-effect of --no-shrinkwrap for this module usage. Your take?

aside: Hey! Last JS dev I did was in jQuery era, so am rusty :-)

zodvik avatar Mar 13 '18 11:03 zodvik

I don't expect the --no-shrinkwrap option should be an issue for the use case. Option 1 should be a pretty solid way to go.

Good find on that npm issue.

edm00se avatar Mar 13 '18 14:03 edm00se

npm ls doesn't support --no-optional. Looking for a workaround.

zodvik avatar Mar 14 '18 06:03 zodvik