payloadcms / payload

The best way to build a modern backend + admin UI. No black magic, all TypeScript, and fully open-source, Payload is both an app framework and a headless CMS.
https://payloadcms.com
MIT License
20.99k stars 1.26k forks source link

Getting error when using search plugin #6897

Open anvishinc opened 5 days ago

anvishinc commented 5 days ago

Link to reproduction

No response

Payload Version

3.0.0-beta.45

Node Version

v21.6.1

Next.js Version

v14.2.4

Describe the Bug

I just installed search plugin and made this basic configuration

    searchPlugin({
      collections: ["universities", "colleges", "schools"],
      defaultPriorities: {
        universities: ({ doc }) => doc.ratings.overall_rating,
        colleges: ({ doc }) => doc.ratings.overall_rating,
        schools: ({ doc }) => doc.ratings.overall_rating,
      },
      searchOverrides: {
        slug: "search-results",
      },
      beforeSync: ({ originalDoc, searchDoc }) => {
        return {
          ...searchDoc,
          slug: originalDoc.slug,
          name: originalDoc.institution_name,
        };
      },
    }),

And when I started the dev server it immediately started throwing this error

Import trace for requested module:
./node_modules/@payloadcms/ui/dist/providers/ComponentMap/buildComponentMap/fields.js
./node_modules/@payloadcms/ui/dist/utilities/buildComponentMap.js
./node_modules/@payloadcms/richtext-lexical/dist/generateComponentMap.js
./node_modules/@payloadcms/richtext-lexical/dist/index.js
./payload.config.ts
./app/(payload)/api/[...slug]/route.ts
 ⨯ ./node_modules/@payloadcms/ui/dist/providers/ComponentMap/buildComponentMap/fields.js
Attempted import error: 'MissingEditorProp' is not exported from 'payload/errors' (imported as 'MissingEditorProp').

When I remove the plugin the app works right again. Currently using payload and search plugin both at 3.0.0-beta.45

Reproduction Steps

Just installing the search plugin breaks the app

Adapters and Plugins

@payloadcms/plugin-search

AlessioGr commented 3 days ago

Hey @anvishinc can you test if this still is an issue in 3.0.0-beta.53?

anvishinc commented 3 days ago

@AlessioGr I did update it yesterday but had the same error and ended up creating a hook to create my own version of search plugin

This is what I got by the way

Build Error
Failed to compile

Next.js (14.2.4)
./node_modules/@payloadcms/ui/dist/elements/WithServerSideProps/index.js:2:1
Module not found: Can't resolve 'payload/shared'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/@payloadcms/ui/dist/providers/ComponentMap/buildComponentMap/index.js
./node_modules/@payloadcms/ui/dist/utilities/buildComponentMap.js
./node_modules/@payloadcms/richtext-lexical/dist/generateComponentMap.js
./node_modules/@payloadcms/richtext-lexical/dist/index.js
./payload.config.ts
./app/(payload)/api/[...slug]/route.ts
AlessioGr commented 3 days ago

@anvishinc could you share the full package.json you had while you were on 3.0.0-beta.53?