Reproduction link or steps
https://stackblitz.com/edit/github-xs6btxtl
What is expected?
Dependencies (fsevents) declared in optionalDependencies should not appear in the bundle.
What is actually happening?
fsevents has been added to the bundle.
Any additional comments?
As shown in the npm documentation, optionalDependencies are actually a special case of dependencies. For example, many packages declare fsevents as optionalDependencies to ensure that the installation of the main module is not affected if a dependency installation fails. Semantically, these dependencies are guaranteed to exist by the package manager and do not need to be distributed with the package content.
Currently, deps.neverBundle can be used to handle this, but perhaps making this the default behavior would be more reasonable.
Reproduction link or steps
https://stackblitz.com/edit/github-xs6btxtl
What is expected?
Dependencies (
fsevents) declared inoptionalDependenciesshould not appear in the bundle.What is actually happening?
fseventshas been added to the bundle.Any additional comments?
As shown in the npm documentation,
optionalDependenciesare actually a special case ofdependencies. For example, many packages declarefseventsasoptionalDependenciesto ensure that the installation of the main module is not affected if a dependency installation fails. Semantically, these dependencies are guaranteed to exist by the package manager and do not need to be distributed with the package content.Currently,
deps.neverBundlecan be used to handle this, but perhaps making this the default behavior would be more reasonable.