zephyr icon indicating copy to clipboard operation
zephyr copied to clipboard

`-f` removes exports used by other exports

Open i-am-the-slime opened this issue 5 years ago • 2 comments

This might actually be intentional and we will need to update the FFI in the "offending" module. I'm using react-basic-hooks. And that has code like this:

exports.useEffect_ = function (eq, deps, effect) {
  var memoizedKey = exports.useMemo_(eq, deps);
  React.useEffect(effect, [memoizedKey]);
};

I don't use useMemo_ (in fact I can't since it's not exported) but I use useEffect which in turn uses useEffect_ which then can't find useMemo_.

Would you say this is a bug or should the FFI be rewritten in a way that avoids this?

Edit: Yeah I just had a look at dce-output and that's what's happening. I will try to rewrite the FFI.

i-am-the-slime avatar Jul 31 '20 14:07 i-am-the-slime

I'd say it's a bug. Would this reproduce the issue:

exports.a = exports.b
exports.b = 1

Even though a is referenced by a PureScript module, b is not preserved. Do I got it right?

coot avatar Jul 31 '20 17:07 coot

My example did not reproduced the problem, do you happen to have a small example that illustrates the problem?

coot avatar Aug 11 '20 20:08 coot