MaybeJustJames/zephyr

`-f` removes exports used by other exports

i-am-the-slime opened this issue · 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.

coot commented

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 commented

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