[js] Should multiple FFI imports compile to a single ESM re-export? #1168
hayleigh-dot-dev
started this conversation in
Ideas & suggestions
Replies: 2 comments 1 reply
-
Yes, definitely. This makes much nicer looking code |
Beta Was this translation helpful? Give feedback.
0 replies
-
Locking this as it is implemented! Thank you |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently when compiling a Gleam module with multiple external fns from the same source, we compile to multiple import/export pairs:
This can actually be reduced to just one line using ESM re-exports, resulting in:
I'm not sure whether this is a tangible win or not, I believe imports are cached so it's not like you'd hit the network multiple times with the current approach and it's nice to have the compiled module more-or-less follow the order of declaration that the original source did.
Beta Was this translation helpful? Give feedback.
All reactions