geist-org / geist-ui

A design system for building modern websites and applications.
https://geist-ui.dev
MIT License
4.33k stars 334 forks source link

Hoisting errors in monorepo using yarn workspaces #464

Closed KingScooty closed 3 years ago

KingScooty commented 3 years ago

Bug report 🐞

Version & Environment

Expection

I'd expect to be able to run a nextjs project with geist in a monorepo using yarn workspaces.

Actual results (or Errors)

If i try and run a next project with geist installed in a monorepo (using yarn workspaces), i get the following error:

Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app

Workaround (but suboptimal)

It seems to be due to a yarn workspaces hoisting issue when geist is hoisted to the root node_modules of the monorepo. If i set the nextproject to nohoist the issue goes away. (but this is suboptimal)

  "workspaces": {
    "packages": [
      "packages/*",
    ],
    "nohoist": ["nextproject"]
  },

Is Geist performing any actions that require it to be in the project level node_modules ?

KingScooty commented 3 years ago

Gonna close this. After further investigation, it looks like a clash being caused by a Strapi.io project within the monorepo. That seems to be the culprit.