Class extends value #<Object> is not a constructor or null when reconstructing node module hierarchy

Viewed 69

I have this problem :

I have this Directories Hierarchy:

Main-Directory

   -SubProject1

      -Package.json 

      -DirectoryA

        -DirectoryB

          -Package.json 

          -DirectoryC

             -Package.json 

    -SubProject2

       -Package.json 

and to avoid having many node_modules and dependencies I decided to use Yarn workspaces first I tried with the Subproject1 directory (I considered it as a monorepo) and everything installed in its node-modules and the project is working fine. I know yarn workspaces doesn't support nested workspaces so I have to put in the SubProject1/package.json:

    "workspaces": {
      "packages": ["DirecotryA/DirectoryB/DirectoryC", "DirectoryA/*]
   }

then I wanted to do the same for the whole project so I created package.json in the Main Directory and added

    "workspaces": {
      "packages": ["SubProject1/DirectoryA/DirectoryB/DirectoryC" , "SubProject1/DirectoryA/*", "./SubProject1", "./SubProject2"]
   }

and all the node modules are installed in the node_modules folder in the main directory (except for some dependencies with different versions)

now after I run my project I got:

Class extends value # is not a constructor or null

even though no change was made to the code.

So my question is: could rebuilding the hierarchy of the node modules lead to this kind of errors? I searched and I found out that there might be a cycled dependency, but I didn't change anything except for using yarn workspaces

So does anyone knows why this could happen?

0 Answers
Related