entria-fullstack icon indicating copy to clipboard operation
entria-fullstack copied to clipboard

add metro.config.js to work well on workspaces

Open sibelius opened this issue 5 years ago • 4 comments

https://gist.github.com/sibelius/14d0ecdbd917959c0f7b6f1c4f81f850

sibelius avatar Mar 01 '19 12:03 sibelius

more sutff here https://gist.github.com/sibelius/53b3ea832d9b0d46b7b3903c6d842b85

sibelius avatar May 07 '19 14:05 sibelius

more sutff here https://gist.github.com/sibelius/53b3ea832d9b0d46b7b3903c6d842b85 Thanks - that is super helpful!

Although, I kept getting the error: https://reactjs.org/warnings/invalid-hook-call-warning.html After some digging, it looks that I have multiple downloads of React - in the various node_modules. The solution seems to be to force hoist it, so it only lives at root. I'm struggling to get this working though.

Braden1996 avatar May 25 '19 21:05 Braden1996

try this nohoist on root package.json

"workspaces": {
    "packages": [
      "packages/*"
    ], 
    "nohoist": [
      "**/react-native",
      "**/react-native-*",
    ]
}

sibelius avatar May 27 '19 12:05 sibelius

try this nohoist on root package.json

"workspaces": {
    "packages": [
      "packages/*"
    ], 
    "nohoist": [
      "**/react-native",
      "**/react-native-*",
    ]
}

After some digging, it seemed that I had two physical versions of React on-disk. My application was using both of them, which broke hooks. I fixed this by adding the following to my root:

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

Braden1996 avatar Jun 07 '19 10:06 Braden1996