Darginec05 / Yoopta-Editor

Build Notion-like, Craft-like, Coda-like, Medium-like editors with Yoopta
https://yoopta.dev/
MIT License
784 stars 61 forks source link

[BUG] Import error when using nextjs #179

Closed madroneropaulo closed 1 month ago

madroneropaulo commented 1 month ago

Has this bug been raised before?

Description

I'm trying out this library with nextjs in a brand new project from scratch.

When I try to run the script I get this error:

⨯ ./node_modules/@yoopta/callout/dist/index.js
Attempted import error: 'Elements' is not exported from '@yoopta/editor' (imported as 't').

Import trace for requested module:
./node_modules/@yoopta/callout/dist/index.js
./app/casts/edit/[id]/page.tsx
 GET /casts/edit/123 500 in 34ms
 ⨯ ./node_modules/@yoopta/callout/dist/index.js
Attempted import error: 'Elements' is not exported from '@yoopta/editor' (imported as 't').

NOTE: I installed the dependencies with npm --legacy-peer-deps because otherwise it had some dependencies conflicts with slate.

Steps to Reproduce

  1. Start a new nextjs project from scratch
  2. Use this code in that project https://github.com/Darginec05/Yoopta-Editor/blob/master/web/next-example/src/components/examples/withBaseFullSetup/index.tsx.
  3. Install dependencies with npm i @yoopta/callout --legacy-peer-deps
  4. try to run the project: Result you get that error.

P.S. It happens with many plugins, but not with all of them. Failing: Callout, lists, embeds, image, video, file. Working: Code, Link, Blockquote, Paragraph, Headings

If I comment out the failing components, it works fine.

Environment

Screenshots

No response

Do you want to work on this issue?

No

If "yes" to above, please explain how you would technically implement this

No response

Darginec05 commented 1 month ago

It looks like you have installed the .alpha version of the packages, which is not stable. Could you please use `@4.4.1 for all packages?

madroneropaulo commented 1 month ago

Yeah, that did the trick. Thank you!