easy-markdown-editor icon indicating copy to clipboard operation
easy-markdown-editor copied to clipboard

Is there plan for ES Module support?

Open CaptainYouz opened this issue 4 years ago • 6 comments

Everything in the title!

(thanks for this great fork 👍 )

CaptainYouz avatar Oct 30 '20 18:10 CaptainYouz

I did a quick test with browserify and the plugin efmify but it does not look like I can easily convert the editor to an ESM compatible package. However I do think providing an ESM package should be a goal to work towards.

Ionaru avatar Oct 30 '20 22:10 Ionaru

+1 here too! Seems like there is a lot of opportunity to reduce the codemirror bundle size through selective imports.

jameschristopher avatar Nov 22 '20 05:11 jameschristopher

+1

Warfenix avatar Dec 03 '20 14:12 Warfenix

How do I import this library whether it's ES Modules or not? I don't see any examples using import in the README.

amcsi avatar Jun 15 '22 10:06 amcsi

Using npm you can import it like any other npm package: https://docs.npmjs.com/using-npm-packages-in-your-projects

Otherwise use one of the CDN scripts, the editor will then be available globally.

Ionaru avatar Jun 16 '22 08:06 Ionaru

I tried this:

import EasyMDE from "easymde";

new EasyMDE();

And I got:

TypeError: Cannot read properties of undefined (reading 'getAttribute')
push../node_modules/easymde/src/js/easymde.js.EasyMDE.render
node_modules/easymde/src/js/easymde.js:2110

amcsi avatar Jun 16 '22 10:06 amcsi