React Intl `undefined()` 必须使用对象表达式调用

React Intl `undefined()` must be called with an object expression

React intl 没有建立在 CI 上,出现以下错误:

[React Intl] undefined() must be called with an object expression with values that are React Intl Message Descriptors, also defined as object expressions.

试过这个: Issue link 但是没用。

import ConnectedComponent from './ConnectedComponent';
import {connect} from 'react-redux';
import {injectIntl, defineMessages} from 'react-intl';

const messages = defineMessages({
    LABEL: {id: "CONNECTED.COMPONENT.LABEL", defaultMessage: "Label"},
});

const mapStateToProps = (state, ownProps) => {
    const { intl } = ownProps;
    return {
        inputLabel: intl.formatMessage(messages.LABEL),
    };
};

export default injectIntl(connect(
    mapStateToProps
)(ConnectedComponent));

看起来这是 babel-plugin-react-intl [1] 中的错误,据说已经修复。

[1] https://github.com/formatjs/formatjs/issues/37