Module parse failed: Unexpected token (1:0)

Viewed 353

I am using a library called ract-chat-widget, which requires me to import css in my component, like this

import 'react-chat-widget/lib/styles.css

But my build is failing with below error :

    ERROR in ./node_modules/react-chat-widget/lib/styles.css 1:0
    Module parse failed: Unexpected token (1:0)
    You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

I have tried adding css-loader for this as well, but the error remains same.

     {
        test: /\.(css)$/,
        include: [
          path.resolve(__dirname, `./node_modules/react-chat-widget/lib`)
        ],
        use: [
          {
            loader: `css-loader`,
            options: {
              includePaths: [
                path.resolve(__dirname, `./node_modules/react-chat-widget/lib`)
              ]
            }
          }
        ]
      }

I have tried providing this config in different formats as well.I am not sure what else to check.

1 Answers

It seems I am able to import the CSS in the component's .sccs file, that too without any extra webpack config.

Related