wnr / element-resize-detector

Optimized cross-browser resize listener for elements.
MIT License
1.32k stars 118 forks source link

[Feature Request] Provide an ECMAScript module (ESM) bundle #126

Closed Lonli-Lokli closed 3 years ago

Lonli-Lokli commented 4 years ago

Provide an ECMAScript module (ESM) bundle instead of only commonJS ref: https://web.dev/commonjs-larger-bundles/

wnr commented 4 years ago

Seems like a good thing! Would you create a PR? :)

nachodd commented 1 year ago

I have some issues with this package for the same reason. To put it in context: I'm using vue-grid-layout-v3 which uses your library. Everything is fine, until I try to use vue-grid-layout-v3 with Vite, which uses ESM packages under the hood. So it was throwing me errors like "element-resize-detector doesn't have a default export". So, it seems that the problem is that your library is not ESM compatible. I needs a rewrite... OR, maybe we can use a tools like: to-esm and generate different entry points. What do you think? I haven't tried it, but seems promising. If you accept, I can try it.