Skip to content

Declare framework peer dependencies as optional #255

@fkl-fp

Description

@fkl-fp

Problem Description

First of all, great work so far! I really appreciate the modular approach and wide framework support, but regarding the dependency installation, this comes with a downside right now. All the different frameworks (e.g. Vue, React, ...) are declared as peer dependencies in the package.json of the different packages (see for example packages/core/package.json).

As of npm@7 the peer dependencies are automatically installed if they are not yet present.
This means, that React, Svelte and Co. are installed even though I might only want to use the Vue functionality.

To keep the modular approach also on dependency level, I would appreciate it if I was in control of what specific framework dependencies are installed.

Suggested solution

The frameworks are correct in the peer dependency section, but with the peerDependenciesMeta it is possible to mark them as optional.

"peerDependenciesMeta": {
  "preact": { "optional": true },
  "react": { "optional": true },
  "react-dom": { "optional": true },
  "svelte": { "optional": true },
  "vue": { "optional": true }
},

This way the peer dependency restriction are still checked, when I have a specific framework installed, but I only need one framework installed for my specific case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions