I'm currently trying to add a peerDependency to my project which can be overriden by multiple different packages.
Let's say I have a package: "@namespace/icons" which is one of my peerDependencies
"peerDependencies": {
"@namespace/icons": "*"
}
"@namespace/icons" is currently a package which I defined in on of our custom registries. This works fine. The package is exporting some icons as Web-Components and some types including the icon names for better autocompletion.
Now I want to add the ability to override this peerDependency with another custom package which uses the same API as "@namespace/icons". Let's name it "@namespace2/custom-icons".
But because the package name has another name, I want to define a generic peerDependency name which can either install "@namespace/icons" or can be overriden from an upperlying package.json with "@namespace2/custom-icons".
I tried aliasing the package name by installing it like this:
"peerDependencies": {
"icons": "npm:@namespace/icons@^1.0.0"
}
and adding a custom dependency into my application:
"dependency": {
"icons": "file:custom-icons-1.0.0.tgz"
}
This unfortunately doesn't work because the dependencies cannot be resolved properly. Also renaming the package "custom-icons" to "icons" didn't seem to work.