Open ad1992 opened 1 year ago
This is extremely important for the future of this package. I'm willing to help however I can to make this happen. The community would appreciate it a lot!
Thanks @RegiByte. The effort is underway! We'll post in this issue if there are actionable issues someone could help with.
Do you have experience with publishing ESM packages yourself?
@dwelle I have experience publishing ESM and CJS packages, for Excalidraw I don't think CJS will be needed so it's a little easier.
If I can help in any way just let me know, I'm mostly using Excalidraw with rich-text editors like ProseMirror and Lexical, they integrate nicely but the lack of ESM support causes problems with some bundlers depending on how they are configured.
I never contributed to Excalidraw directly but I'd be really happy to if I have the opportunity.
@ad1992 any updates on this? Looks like all required pull requests were merged
I saw the to-do list was finished. Do you know if we have any updates on this issue?
WHY
We currently only support the
UMD
build for the package which works well for the browser as well as the node. But we also lose the benefits of tree shaking and importing specific utils which aren't possible withumd
build.One recent example is the package @excalidraw/mermaid-to-excalidraw where we wanted to import only a function
convertToExcalidrawElements
from the package but to do that we will need to addreact
,react-dom
unnecessarily which leads to increase in bundle size as well as taking more bandwidth.Hence we should support the ESM build, the UMD build will always be there for fallback.
With ESM Build we can support
convertToExcalidraw
function so the host doesn't need to call it explicitly when using the packageHOW
There are a few changes needed in the codebase before we start supporting ESM
NodeNext
as module resolution and module to support ESM syntax eg https://github.com/excalidraw/mermaid-to-excalidraw/pull/30With these changes for the ESM build, we will also get closer to Monorepo architecture