How do I set a peer dependency optional?
Since NPM v7.x, you can use the peerDependenciesMeta package.json config, which allows exactly that option. For example, in your “Module A” package.json: “peerDependencies”: { “winston”: “> 1.0.0 <= 1.2.10”, “foo”: “~2.3.0” }, “peerDependenciesMeta”: { “winston”: { “optional”: true } } In this case, when installing Module A as a dependency of another project, it will … Read more