We are building a monorepo project with TurboRepo and yarn 3 workspaces. In our monorepo we have two packages website and core.website is a nextjs application and core is a reusable component library bundled with rollup. We have the following package.json declarations in both of these projects:
// website package.json
...
"dependencies": {
"core": "*",
"next-auth": "^4.22.1"
....
}
...
and
// core package.json
...
"peerDependencies": {
"next-auth": "4.x",
....
}
...
So website has a dependencies to next-auth and core and this last one has a peer dependency to next-auth. When building the website project we get the following error:
website:build: ../../core/dist/index.js
website:build: Module not found: Can't resolve 'next-auth/react'
If website has next-auth in its dependencies why is this error happening?