Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Error while using with webpack #25

Closed
@nmaves

Description

@nmaves

When I run webpack I get the following error.

ERROR in ./app/components/Home.js
Module build failed: SyntaxError: /Users/nmaves/projects/maves-software/intensity/app/components/Home.js: [React Intl] Message must have a `description`.
  2 | import {defineMessages, injectIntl, intlShape, FormattedMessage} from 'react-intl'
  3 | 
> 4 | const messages = defineMessages({
    |                  ^
  5 |   greeting: {
  6 |       id: 'greeting',
  7 |       description: 'Welcome greeting to the user',

Here is my webpack.config.js

module.exports = {
    entry: "./app/App.js",
    output: {
        filename: "public/bundle.js"
    },
    module: {
        loaders: [
            {
                test: /\.jsx?$/,
                exclude: /(node_modules|bower_components)/,
                loader: 'babel',
                query: {
                    presets: ['react', 'es2015'],
                    plugins: ['react-intl']
                }
            }
        ]
    }
}

Here is my test component.

import React from 'react'
import {defineMessages, injectIntl, intlShape, FormattedMessage} from 'react-intl'

const messages = defineMessages({
    greeting: {
        id: 'greeting',
        description: 'Welcome greeting to the user',
        defaultMessage: 'Hello, {name}! How are you today?'
    }
});

class Home extends React.Component {

    constructor(props) {
        super(props);
        this.state = {}
    }

    render() {
        return (
            <div>
                <FormattedMessage {...messages.greeting} />
            </div>
        )
    }
}

export default Home;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions