sstur / react-rte

Pure React rich text WYSIWYG editor based on draft-js.
https://react-rte.org
ISC License
2.86k stars 430 forks source link

Mixed up default and named imports #353

Open paul-mesnilgrente opened 4 years ago

paul-mesnilgrente commented 4 years ago

Hi,

I am currently trying to use server side rendering in a rails project with react-rte and I am hitting this issue:

If I import RichTextEditor from 'react-rte/lib/RichTextEditor';, Rails is throwing me this error:

Invariant Violation: Element type is invalid: expected a string
(for built-in components) or a class/function (for composite components)
but got: undefined. You likely forgot to export your component from the
file it's defined in, or you might have mixed up default and named imports

It's same if I simply import import RichTextEditor from 'react-rte.

Do you have any idea of the why?

I see that in the react-rte/lib/RichTextEditor.js. You have this code:

export default RichTextEditor;

// $FlowIssue - This should probably not be done this way.
_Object$assign(RichTextEditor, {
 ...
});

export { EditorValue, decorator, createEmptyValue, createValueFromString, ButtonGroup, Button, Dropdown };

Is this comment a hint or not? We clearly can see that we are mixing default and named exports here as well. Is there a way to fix this?

ieatmangos commented 3 years ago

Hi I am getting this same issue trying use Next.js. Is there a fix for this?

paul-mesnilgrente commented 3 years ago

Sorry, I can't remember :/