Skip to content

optionalDependencies should not be added to bundle by default #850

@CyanSalt

Description

@CyanSalt

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions