davesnx/babel-plugin-transform-react-qa-classes

Cannot read property 'name' of undefined when props spread is passed.

Jony-Y opened this issue · 2 comments

Using transform-react-qa-classes: 1.5.0
in babelrc:

if (process.env.CLUSTER !== 'production' && process.env.NODE_ENV !== 'test') {
  plugins.push('transform-react-qa-classes');
  if (process.env.NODE_ENV !== 'production') {
    plugins.push('react-docgen');
  }
}

when running babel (with NODE_ENV=production), For all components with {...props} there is a crash - Cannot read property 'name' of undefined.

component example:

import React from 'react';
import cn from 'classnames';
import PropTypes from 'prop-types';

const BaseButton = ({
  color,
  children,
  className,
  style,
  variant,
  isLoading,
  disabled,
  type,
  ...otherProps
}) => (
  <button
    type={type}
    className={cn(
      { 'btn-loading': isLoading },
      'transition-all',
      'btn base-btn',
      { [`btn-${colors[color]}`]: colors[color] },
      { [`btn-${variant}`]: variant },
      className
    )}
    {...otherProps}
    style={style}
    disabled={disabled}
  >
        {children}
  </button>
);

export default BaseButton;

Can you try with 1.6.0?

verified, works good. thanks!