How to use multiple react versions in pnpm monorepo structure

288 views Asked by At

I have yarn + lerna based monorepo and I'm trying to migrate it to PNPM.

I couldn't find the way to use different react versions per packages in pnpm

My project structure is like this:

root 
ㄴ packages
   ㄴ app1  <- it requires react 18.x
   ㄴ app2  <- it requires react 18.x
   ㄴ app3  <- it requires react 17.x
   ㄴ shared 

since the app3 is used in different environments we cannot upgrade react version like other projects.

specifying different react versions for each package.json doesn't solve the problem perfectly : it emits type error for the shared package components imported in app3. (I think that's because shared follows the root react version and the app3 follows older version.)

overrides config can only be used in root package.json, so I don't think it can provide way to set different versions per applications.

are there any solutions for this problem ?

0

There are 0 answers