React-dates: Module parse failed:\node_modules\react-dates\src\components\SingleDatePicker.jsx Unexpected token (109:4) You may need an appropriate loader to handle this file type.

Created on 22 Mar 2017  路  3Comments  路  Source: airbnb/react-dates

here is my file of all loaders :

module.exports = [
    {
        test: /\.jsx?$/,
        exclude: /(node_modules|bower_components)/,
    loaders: ['react-hot', 'babel','babel-loader'],
    },
    {
    test: /\.css$/,
    loaders: [
      'style?sourceMap',
      'css?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]'
    ]
  },
    {
        test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
        loader: "file"
    },
    {
        test: /\.(woff|woff2)$/,
        loader: "url?prefix=font/&limit=5000"
    },
    {
        test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
        loader: "url?limit=10000&mimetype=application/octet-stream"
    },
    {
        test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
        loader: "url?limit=10000&mimetype=image/svg+xml"
    },
    {
        test: /\.gif/,
        loader: "url-loader?limit=10000&mimetype=image/gif"
    },
    {
        test: /\.jpg/,
        loader: "url-loader?limit=10000&mimetype=image/jpg"
    },
    {
        test: /\.png/,
        loader: "url-loader?limit=10000&mimetype=image/png"
    }
];
invalid question

Most helpful comment

Yes, I did. Apparently, I was trying to import the daterangepicker as given in your examples folder from src folder (../src/components/DateRangePicker) which was causing the issue. Instead, now I do it as import DateRangePicker from 'react-dates' and it works.

Thanks

All 3 comments

@aishwarya-bote did you figure this out?

Yes, I did. Apparently, I was trying to import the daterangepicker as given in your examples folder from src folder (../src/components/DateRangePicker) which was causing the issue. Instead, now I do it as import DateRangePicker from 'react-dates' and it works.

Thanks

A bare-bone simple example can be found here: https://github.com/majapw/react-dates-demo/blob/master/src/App.js

Was this page helpful?
0 / 5 - 0 ratings