Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module '@desmoslabs/desmjs' or its corresponding type declarations in Next.js project within DesmJS monorepo #1138

Open
sundayonah opened this issue Jun 20, 2024 · 1 comment

Comments

@sundayonah
Copy link

sundayonah commented Jun 20, 2024

Hello,

I'm currently working on a Next.js project named next-walletconnect-example which is located inside the DesmJS monorepo. I've encountered an issue where TypeScript cannot find the module @desmoslabs/desmjs or its corresponding type declarations. Specifically, it fails to resolve the path to @desmoslabs/desmjs-types/desmos/profiles/v3/models_profile.

Here are the details of my setup:

Next.js Project (next-walletconnect-example):
package.json dependencies include @desmoslabs/desmjs and @desmoslabs/desmjs-types with the workspace: prefix pointing to the local packages within the monorepo.

DesmJS Monorepo (desmjs-monorepo-root):Contains the workspaces configuration in its package.json, listing all the packages and examples within the monorepo.
Local packages @desmoslabs/desmjs and @desmoslabs/desmjs-types are defined with paths relative to the monorepo root.

I have run yarn install both in the root folder and inside the next-connect-wallet folder which comprises of the nextjs project.
I've attempted to resolve this issue by adjusting the baseUrl and adding a paths configuration in my tsconfig.json within the Next.js project.
However, the problem persists.
Could anyone provide guidance on how to correctly configure TypeScript to resolve these local modules within our monorepo setup?
Any insights or solutions would be greatly appreciated.

Thank you!

@dadamu
Copy link
Contributor

dadamu commented Jul 1, 2024

Hi, @sundayonah, sorry for the late reply.

In development mode, it works in typescript so yarn && yarn dev should work properly as well. To get better DX you can try yarn && yarn build in the root path first.
This issue is because IDE couldn't get the built library from packages.

yarn && yarn build # in the root path
cd examples/next-walletconnect-example

Please restart IDE after yarn build as IDE might not update immediately for the build path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants