See my comment in https://github.com/facebook/react/pull/11291#issuecomment-338974574.
I verified https://github.com/facebook/react/pull/11291 introduced this regression.
if (!localState.prodInvariantIdentifier) {
      localState.prodInvariantIdentifier = path.scope.generateUidIdentifier(
        'prodInvariant'
      );
      path.scope.getProgramParent().push({
        id: localState.prodInvariantIdentifier,
        init: t.callExpression(t.identifier('require'), [
          t.stringLiteral('reactProdInvariant'),
        ]),
      });
    }
    return localState.prodInvariantIdentifier;
  }
  var DEV_EXPRESSION = t.identifier('__DEV__');
  return {
    pre: function() {
      this.prodInvariantIdentifier = null;
    },
    visitor: {
      CallExpression: {
        exit: function(path) {
          var node = path.node;