Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Babel interopRequireWildcard reexports #52

Closed
guybedford opened this issue Mar 30, 2021 · 0 comments · Fixed by #53
Closed

Babel interopRequireWildcard reexports #52

guybedford opened this issue Mar 30, 2021 · 0 comments · Fixed by #53

Comments

@guybedford
Copy link
Collaborator

We're currently not detecting the following:

var _Accordion = _interopRequireWildcard(require("./Accordion"));

Object.keys(_Accordion).forEach(function (key) {
  if (key === "default" || key === "__esModule") return;
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function get() {
      return _Accordion[key];
    }
  });
});

As far as I'm aware, this is output for valid export * as x use cases in Babel under certain interop options (not sure which?).

If this is the case, we should probably treat this as a full reexport, equivalent to export * from '...', therefore we should allow this to trigger reexport detection.

The question is if we should specifically filter the interopRequireWildcard function name, and I'm tempted to say yes, despite that it won't work with minification - this is similar to how we handle __exportStar for TypeScript code.

//cc @nicolo-ribaudo would value your thoughts on this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant