Skip to content

Babel interopRequireWildcard reexports #52

Closed

Description

@guybedford

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions