Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify that a package should be installed without optional dependencies within package.json

I've written a chat bot for Discord which utilises the discord.io library. While this library provides support for voice-related automation, the installation of those features can be prevented by using the --no-optional switch, which saves a lot of bandwidth and time.

npm install discord.io --save --no-optional

So far so good, but whether I use that option or not, there's no distinction in package.json between the version installed with the optional dependencies and the one without, therefore when someone goes on to deploy my bot they will download and install all the unnecessary voice-related modules which I do not make use of.

Is there any kind of solution that would result in said package being installed without optional dependencies when npm install is ran in the project folder?

like image 578
SeinopSys Avatar asked Oct 30 '22 21:10

SeinopSys


1 Answers

This does not currently seem to be possible, as reported in npm issue #14185. You can subscribe to that bug report to track progress (if any) on this matter.

like image 105
Ward Muylaert Avatar answered Nov 11 '22 04:11

Ward Muylaert