draftjs-to-html icon indicating copy to clipboard operation
draftjs-to-html copied to clipboard

draftToHtml is not function

Open percysoft opened this issue 6 years ago • 5 comments

at the time of implementing the function I get the following error:

draftjs_to_html_1.default is not a function TypeError: draftjs_to_html_1.default is not a function at WysiwygCustom._this.getContentText (http://localhost:9001/0.b77eb44ab9d2dac8797c.hot-update.js:86:60) at WysiwygCustom._this.onEditorStateChange (http://localhost:9001/0.b77eb44ab9d2dac8797c.hot-update.js:34:42) at WysiwygCustom.webpackHotUpdate.1359.WysiwygCustom.componentDidMount (http://localhost:9001/0.b77eb44ab9d2dac8797c.hot-update.js:121:14) at commitLifeCycles (http://localhost:9001/static/preview.bundle.js:45867:22) at commitAllLifeCycles (http://localhost:9001/static/preview.bundle.js:46961:7) at HTMLUnknownElement.callCallback (http://localhost:9001/static/preview.bundle.js:31719:14) at Object.invokeGuardedCallbackDev (http://localhost:9001/static/preview.bundle.js:31757:16) at invokeGuardedCallback (http://localhost:9001/static/preview.bundle.js:31806:29) at commitRoot (http://localhost:9001/static/preview.bundle.js:47100:7) at completeRoot (http://localhost:9001/static/preview.bundle.js:48115:34)

percysoft avatar Jun 20 '18 17:06 percysoft

I had recently versioned up from 0.8.3 to 0.8.4 and bumped into the same error. I've gone back to 0.8.3 while I try and understand this error more.

geoff5802 avatar Jun 26 '18 19:06 geoff5802

I'm getting this error even with 0.8.3 - any update on that issue?

feather-aurelie avatar Aug 16 '18 20:08 feather-aurelie

I use the following code to solve this error

const draftToHtml = require("draftjs-to-html").default;

or

import draftToHtml from 'draftjs-to-html';

plat123456789 avatar Sep 04 '18 11:09 plat123456789

@jpuri Whereas previously the module flagged itself with an __esModule flag, and had a default export, that's no longer the case.

This is a breaking change for any existing code depending on this lib. Considering it was a minor version bump -- this is very unexpected :disappointed:.

muj-beg avatar Nov 06 '18 21:11 muj-beg

I fixed it with:

import * as draftToHtml from 'draftjs-to-html';

mpochowski avatar Nov 20 '18 12:11 mpochowski