contiamo / operational-ui

Building blocks for effective operational interfaces
https://operational-ui.netlify.com
MIT License
258 stars 47 forks source link

Peer dependencies shouldn't also be actual dependencies #1369

Open justinmchase opened 3 years ago

justinmchase commented 3 years ago

I just encountered an issue installing this where multiple instances of react are running and end up conflicting. This happens when you have any other dependency which depends on react but is different from operational.

Operational publishes the peer dependency information but it also puts those peer dependencies as actual dependencies. This results in operational actually trying to install different versions of these peer dependencies which causes a react runtime issue.

To compound the issue operation publishes the wrong peer dependency versions:

{
  "peerDependencies": {
    "react": "^16.8.0",
    "react-dom": "^16.8.0",
    "react-emotion": "^9.2.5"
  },
  "dependencies": {
    "react": "^16.8.1",
    "react-dom": "^16.8.1",
    "react-emotion": "^10.0.0",
  }
}

Notice the react peers are requesting 16.8.0 but the actual dependencies are 16.8.1. react-emotion is just totally wrong, and so if you install the published peer dependency exactly then it fails. I didn't check the other peer dependencies, these were the only three giving me issues.

I believe the solution is to just remove the dependencies which are also listed in peerDependencies, it's possible that listing them as devDependencies is ok also but I think having them as hard dependencies causes some confusing conflicts at install time.