Reputation: 1466
I have a monorepo with pnpm and I have backend, and 3 nextjs apps that connect to that backend in the monorepo
/packages
/admin -> nextjs
/operator -> nextjs
/backend -> nestjs
/shared -> shared library
I am having a problem in the operator web page, I am trying to export some functions that might be used in the other projects. But functions that are part of the frontend in reactjs I get the following:
It is linking to the project as "../shared/..." so it is going down one folder to link it so that is why I think that is why webpack has a trouble bundling the shared library.
This is what it shows on the pnpm-lock.yaml
Upvotes: 1
Views: 546
Reputation: 1466
Ok, so I figured it out, I was really dumb I was adding my libraries like this
import { apiRequest } from "shared/utils/apiRequest";
And my index.ts in my library
export default {
...
apiRequest,
...
};
I fixed the exports on src/index.ts
import { apiRequest } from "shared";
Exports in my index.ts removed default
export {
...
apiRequest,
...
};
Upvotes: 0