wix-incubator / kampos

Tiny and fast effects compositor on WebGL
https://wix-incubator.github.io/kampos
MIT License
139 stars 10 forks source link

Issues with ESM syntax #21

Open axe312ger opened 1 year ago

axe312ger commented 1 year ago

Hey there,

thanks for the quick reply in #20.

I also noticed that the ESM implementation here is outdated, its pretty annoying to get it working with Gatsby (and probably other frameworks that now use/support ESM)

Can you please remove the https://github.com/wix-incubator/kampos/blob/master/package.json#L7? This should already help.

Alternatively: https://rollupjs.org/introduction/#publishing-es-modules (I think you do that, but your RollUp is v2 and v3 is the current... maybe upgrade? :))

Thank you so much, If you got zero time, I can also give it a try, but didn't do much yet with rollup 🙈

ydaniv commented 1 year ago

@axe312ger yep, I'm actually on it now (:

ydaniv commented 1 year ago

Hey @axe312ger , here's the WIP PR: https://github.com/wix-incubator/kampos/pull/22 I couldn't remove type: module, Rollup keeps screaming at me if I do that. For some reason it keeps complaining of a mismatch between ES modules and Node trying to load CJS 🤷 But I did add a module entry here, maybe that will help. Can you check this somehow on your side?

axe312ger commented 1 year ago

Yeah if you export it as ESM, you have to keep the type: module, so thats fine.

I'll have a look!

ydaniv commented 1 year ago

I wonder whether it's ok to use the src index file as endpoint for ESM, or whether a single pre-built dist is also needed. 🤔

axe312ger commented 1 year ago

AFAIK: At best you compile down to ES6/ES7 and make sure to keep import/export. On 28 Mar 2023, 17:31 +0200, Yehonatan Daniv @.***>, wrote:

I wonder whether it's ok to use the src index file as endpoint for ESM, or whether a single pre-built dist is also needed. 🤔 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

ydaniv commented 1 year ago

@axe312ger should be fixed with 16418e3813a63e91fbed26434bce9f3109c7ca7a. I've published 0.8.0, please try it out and update here. Thanks!

ydaniv commented 1 year ago

@axe312ger did it work for you?