Skip to content

Instantly share code, notes, and snippets.

@hubgit
Last active February 15, 2022 09:06
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hubgit/d3f3e402379e538ed13a53bd3b9562a4 to your computer and use it in GitHub Desktop.
Save hubgit/d3f3e402379e538ed13a53bd3b9562a4 to your computer and use it in GitHub Desktop.
Dynamic import of modules for react-wysiwyg
Promise.all([
import('draft-js'),
import('draftjs-to-html'),
import('html-to-draftjs'),
import('react-draft-wysiwyg'),
import('react-draft-wysiwyg/dist/react-draft-wysiwyg.css')
]).then(([
{ ContentState, EditorState, convertToRaw },
{ default: draftToHtml },
{ default: htmlToDraft },
{ Editor }
]) => {
this.deps = { ContentState, EditorState, convertToRaw, draftToHtml, htmlToDraft, Editor }
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment