springload / draftail

📝🍸 A configurable rich text editor built with Draft.js

Home Page:https://www.draftail.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using Draftail with Rollup

yoongkang opened this issue · comments

Please make sure you have read available documentation and have searched for other resources available online before submitting your question here. Please also have a look at Draftail’s Help resources

Thanks!


Hi, thanks for all the work on Draftail, can't wait to try it out on Wagtail.

I'm trying to integrate Draftail into a React project using Rollup, but am having a bit of trouble. I'm new to rollup, so this could very well be a configuration error on my part, but would appreciate even just pointing me in the right direction.

Here's an example repo where I've used the example "Getting Started" code in a basic rollup project: https://github.com/yoongkang/draftail-rollup-problem

I'm getting an error when attempting to render DraftailEditor within a functional component. The error message says:

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

Check the render method of `DraftailEditor`.

It looks like the import didn't resolve properly, but I'm having a bit of trouble tracking down exactly why. I get no errors when attempting to render a different component.

Also worth noting I'm not getting this error with the same code when I use CRA, so this is likely not a draftail bug. Probably low-priority if you're busy, but would be nice not to be stuck with Webpack.

Any pointers in the right direction would be very appreciated. Thank you again for all the hard work!


Which terms did you search for in the docs, issues, Stack Overflow?

  • Rollup
  • Draftail
  • Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
  • In the https://www.draftail.org/ documentation I searched for: Rollup.
  • In the issues / pull requests, I searched for: Rollup.
  • In Stack Overflow, I searched for: Rollup, DraftJS.