#Can't get .find local api to work

8 messages · Page 1 of 1 (latest)

merry torrent
#

When trying to import getPayloadHMR using:
import { getPayloadHMR } from "@payloadcms/next/utilities";

i get the error:

Cannot find module '@payloadcms/next/utilities' or its corresponding type declarations. There are types at '/Users/luiskisters/Desktop/Code/Work/frontend/node_modules/@payloadcms/next/dist/exports/utilities.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.ts(2307)
this does't happen in the payload 3.0 test repo. I am just trying to use the local api using payload.find() but when I tried, I got a error that a slug for a collection I know exists, doesn't exist. In a issue someone said that I need to use getPayloadHMR so that is why I am trying to use getPayloadHMR in the first place. I just want payload.find() to work.

merry torrent
#

Can't get .find local api to work

#

When I try to use getPayload

`import payloadConfig from "../../../payload.config";
...
export async function fetchBlogs() {
const payload = await getPayload({ config: payloadConfig });

const articles = await payload.find({
collection: "articles",
});

return articles;
}I get Import trace for requested module:
./node_modules/.pnpm/@[email protected]_@[email protected][email protected]_r_iqo7sgu3adcc4h7ilijzmwl2he/node_modules/@payloadcms/richtext-lexical/dist/field/features/relationship/nodes/components/RelationshipComponent.js
GET /blog 500 in 13475ms
⨯ ./node_modules/.pnpm/@[email protected]_@[email protected][email protected]_r_iqo7sgu3adcc4h7ilijzmwl2he/node_modules/@payloadcms/richtext-lexical/dist/field/features/relationship/nodes/components/RelationshipComponent.js
Attempted import error: '@payloadcms/ui/hooks/usePayloadAPI' does not contain a default export (imported as 'usePayloadAPI').

Import trace for requested module:
./node_modules/.pnpm/@[email protected]_@[email protected][email protected]_r_iqo7sgu3adcc4h7ilijzmwl2he/node_modules/@payloadcms/richtext-lexical/dist/field/features/relationship/nodes/components/RelationshipComponent.js`

#

I really want to use payload but I feel like it is pretty hard to integrate into the existing project and I'm thinking about using another solution

slate gazelle
#

Can you update the moduleResolution option in your config?

merry torrent
#

i found a different solution, thanks tho for doing so much support

wraith bramble