Dynamic import doesn't work with `external` that defines a function
#6663 fixed an issue where @module("..") external .. would also emit a static import. But it looks like external + dynamic import isn't very well supported if the external is an arrow. Here's a playground link.
Wondering if that's on purpose or an oversight. Obviously you can extract the arrow to type f = string => unit or something along those lines, but that disables a few optimizations and you can't use attributes such as @unwrap and friends.
I guess this is what has been described as a limitation in https://github.com/rescript-lang/rescript-compiler/pull/6664#issuecomment-1976247679
I guess this is what has been described as a limitation in #6664 (comment)
Thanks for refreshing my memory. You're right, it's something we didn't implement due to the limitations of our implementation at the time.
@mununki to fix this, you can probably attach an attribute to the primitive translation here:
https://github.com/rescript-lang/rescript-compiler/blob/30b38a0aaab27ad4c99f34037b1cc4d61589da8e/jscomp/ml/translcore.ml#L504-L510
that you then use when compiling the lambda