sanity-io / next-sanity

Sanity.io toolkit for Next.js
https://www.sanity.io/
MIT License
784 stars 93 forks source link

Cannot find module 'next-sanity' or its corresponding type declarations. #1656

Closed crazycodestar closed 1 month ago

crazycodestar commented 2 months ago

All I've done is follow the installation guide to integrate sanity into Nextjs npx create sanity@latest. But when I go to the client.ts file. it shows an error Cannot find module 'next-sanity' or its corresponding type declarations. on the import { createClient } from "next-sanity".

Edit: I should also not that it would work like the package is still installed, if anyone was wondering

patrickaigbogun commented 1 month ago

This is a serious issue with the nextjs integration, i have been battling with it as well for the past 10hours, the solution is to move your sanity.config.* file into your sanity folder and switch all imports to sanity for piece of mind. essentially do not use next-sanity

stipsan commented 1 month ago

Hi, in order to help you we need you to provide a link to a github repository that demonstrates the problem. You may fork one of our templates and alter it until it reproduces the problem. Once you have that create a new issue and we'll jump right in and be able to assist. Thanks!