Module not found: Can't resolve '@your-org/core-lib' in next js? #169
Replies: 1 comment 5 replies
-
could you try
Try to keep
Yes that's the idea 😄 , if you want to know why... it's explained in the readme, number 7.
Be sure to take a look at the readme. Important files are next.config.js and tsconfig.json. |
Beta Was this translation helpful? Give feedback.
-
I am new in monorepo or yarn workspace .So learning I follow this starter boilerplate
https://github.com/belgattitude/nextjs-monorepo-example
I forked the above example .And run
yarn
command on root folder .Initially I got this errorCouldn't find package "@your-org/core-lib@workspace:*"
I resolved above error by using version instead of
*
I resolve above error like this
instead of
Then when I run
yarn
my all packages are installed on root directory.when I move inside directory usingcd apps/blog-app
and runyarn dev
.my application run perfectly and show the first page.NOTE : I don't start anything like example
ui-lib
andcore-lib
.but when I change anything oncore-lib
.it automatically reflecting .Not sure how it is happening withoutwatch
orbuild
command. ??Now I create a new nextjs app in
apps
folder.I used this command
yarn create next-app --typescript
with a name ofnew-app
.but when I run
yarn dev
it is successfully build and run .but I am trying to use this"@your-org/core-lib"
package in my new app .I am getting module not found error.I have already used
yarn add @your-org/core-lib
innew-app
directory not on root directory but this still getting same errorModule not found: Can't resolve '@your-org/core-lib' ?
I am using like this
here is my whole code
https://replit.com/@naveennsit/nextjs-monorepo-example#apps/new-app/pages/index.tsx
kindly suggest where I am doing wrong ?
Beta Was this translation helpful? Give feedback.
All reactions